-
Notifications
You must be signed in to change notification settings - Fork 0
/
TRAP.BAS
53 lines (53 loc) · 1.63 KB
/
TRAP.BAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
0 RANDOMIZE
1 PRINT CHR$(26):WIDTH 80:PRINT TAB(34);"TRAP":PRINT
2 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
3 PRINT:PRINT:PRINT
10 G=6
20 N=100
30 REM-TRAP
40 REM-STEVE ULLMAN, 8-1-72
50 PRINT " DO YOU WANT INSTRUCTIONS";
60 INPUT Z$
70 IF LEFT$(Z$,1)<>"Y" THEN 180
80 PRINT:PRINT "I AM THINKING OF A NUMBER BETWEEN 1 AND";N;CHR$(8);".":PRINT
90 PRINT "TRY TO GUESS MY NUMBER. ON EACH GUESS,"
100 PRINT "YOU ARE TO ENTER 2 NUMBERS, TRYING TO TRAP"
110 PRINT "MY NUMBER BETWEEN THE TWO NUMBERS. I WILL"
120 PRINT "TELL YOU IF YOU HAVE TRAPPED MY NUMBER, IF MY"
130 PRINT "NUMBER IS LARGER THAN YOUR TWO NUMBERS, OR IF"
140 PRINT "MY NUMBER IS SMALLER THAN YOUR TWO NUMBERS."
145 PRINT
150 PRINT "IF YOU WANT TO GUESS ONE SINGLE NUMBER, TYPE"
160 PRINT "YOUR GUESS FOR BOTH YOUR TRAP NUMBERS."
165 PRINT
170 PRINT "YOU GET";G;"GUESSES TO GET MY NUMBER."
180 X=INT(N*RND(1))+1
190 FOR Q=1 TO G
200 PRINT
210 PRINT "GUESS #";Q;
220 INPUT A,B
230 IF A=B AND X=A THEN 400
240 IF A <= B THEN 260
250 GOSUB 360
260 IF A <= X AND X <= B THEN 320
270 IF X<A THEN 300
280 PRINT "MY NUMBER IS LARGER THAN YOUR TRAP NUMBERS."
290 GOTO 330
300 PRINT "MY NUMBER IS SMALLER THAN YOUR TRAP NUMBERS."
310 GOTO 330
320 PRINT "YOU HAVE TRAPPED MY NUMBER."
330 NEXT Q
340 PRINT:PRINT "SORRY, THAT'S";G;"GUESSES. THE NUMBER WAS";X;CHR$(8);"."
345 PRINT
350 GOTO 410
360 R=A
370 A=B
380 B=R
390 RETURN
400 PRINT "YOU GOT IT!!!"
410 PRINT
420 INPUT "WANT TO TRY AGAIN";ANS$
430 IF LEFT$(ANS$,1)="Y" GOTO 180
440 IF LEFT$(ANS$,1)="y" GOTO 180
450 RUN "MENU"