home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
BASIC1.ZIP
/
GUESS_2.BAS
< prev
next >
Wrap
BASIC Source File
|
1985-04-03
|
1KB
|
20 lines
10 RANDOMIZE 're-seeds the random number generator (keep the game interesting!)
20 NUMBER=INT(RND*1000)+1 'pick a random integer between 1 and 1000
30 PRINT "I know a number between 1 and 1000, try and guess what it is."
40 INPUT "What is you guess";GUESS
50 COUNT=1
60 IF NUMBER=GUESS THEN PRINT "Wow! One guess, you must be lucky!":GOTO 170
70 DIFFERENCE=ABS(NUMBER-GUESS) 'find how far away the guess is
80 IF DIFFERENCE<100 THEN PRINT "You're real close.":GOTO 110
90 IF DIFFERENCE<250 THEN PRINT "You're kind'a close.":GOTO 110
100 PRINT "Wow, are you ever off!"
110 INPUT "What is you guess";GUESS
120 COUNT=COUNT+1
130 IF NUMBER=GUESS THEN 160
140 IF DIFFERENCE>ABS(NUMBER-GUESS) THEN PRINT "You are getting closer ... "; ELSE PRINT "You did better last time! ";
150 DIFFERENCE=ABS(NUMBER-GUESS):GOTO 110
160 PRINT "You got it in";COUNT;"guesses!"
170 INPUT "Would you like to play again (Y/N)";AGAIN$
180 IF AGAIN$="Y" OR AGAIN$="y" THEN 20
u got it in";COUNT;"guesses!"
170 INPUT "Would y