' GUESS.BAS
' This program is a guess-a-number game.  The program generates a
'   random number and asks the user to guess what it is.  After the
'   user has guessed the number, the program displays the number
'   of guesses made.

CLS

PRINT "Guess-a-number game"
PRINT
PRINT "I'm thinking of a number between 1 and 100."
PRINT "Can you guess what it is?"
PRINT

RANDOMIZE TIMER

randNum% = INT(RND * 100)                ' generate random number
numGuesses% = 0                          ' start with a clean slate

DO
    INPUT "What is your guess?  ", guess%
    SELECT CASE guess%
       CASE IS = randNum%
           PRINT "Congratulations!!"
       CASE IS < randNum% - 10
           PRINT "Brrr!  You're cold!  Try a bigger number."
       CASE IS > randNum% + 10
           PRINT "Brrr!  You're cold!  Try a smaller number."
       CASE IS <> randNum%
           PRINT "You're warm..."
    END SELECT
   
    numGuesses% = numGuesses% + 1        ' chalk up one guess
    PRINT                                ' print a blank line

LOOP UNTIL guess% = randNum%

PRINT "You guessed the number in"; numGuesses%; "tries!"



