trates a good use of random numbers, but also introduces some addi-
tional programming theory.
In running this program, a random number, NM, will be generated.
NEW
1 REM NUMBER
GUESSING GAME
2 PRINT "{CLR,IHOME}"
5 INPUT "ENTER UPPER LI t'!IT FOR GUESS "; LI
10 NM = INT<LI*RND<I»+1
15 CN = 0
20 PRINT "I'VE GOT THE NUMBER.":PRINT
30 INPUT "WHAT'S YOUR GUESS"; GU
35 CN = CN + 1
40 IF GU ::> NM THEN PRINT "MY NUMBER IS
LOWER": PRINT: GOTO 30
50 IF GU < Nt'! THEN PRI NT "t'!Y NUt'!BER IS
HIGHER": PRIN1. : GOTO 30
60 PRI NT "GREAT! YOU GOT MY NUMBER"
65 PRINT "IN ONLY "; CN ;"GUESSES.":PRINT
70 PRINT "DO YOU WANT TO TRY ANOTHER <Y,IN)";
80 GET AN$: IF AN$="" THEN 80
90 IF AN$ = "Y" THEN 2
100 IF AN$
<::> "N" THEN 70
110 END
You can specify how large the number will be at the start of the pro-
gram. Then, it's up to you to guess what the number is.
A sample run follows along with an explanation.
51