mirror of
https://github.com/rfivet/BCG101.git
synced 2024-12-18 08:06:27 -05:00
38 lines
766 B
QBasic
38 lines
766 B
QBasic
1 PRI "THIS IS A NUMBER GUESSING GAME. I'LL THINK"
|
|
2 PRI "OF A NUMBER BETWEEN 1 AND ANY LIMIT YOU WANT."
|
|
3 PRI "THEN YOU HAVE TO GUESS WHAT IT IS."
|
|
4 PRI
|
|
5 PRI "WHAT LIMIT DO YOU WANT";
|
|
6 INPL
|
|
7 PRI
|
|
8 L1=INT(LOG(L)/LOG(2))+1
|
|
10 PRI"I'M THINKING OF A NUMBER BETWEEN 1 AND"L
|
|
11 G=1
|
|
14 PRI "NOW YOU TRY TO GUESS WHAT IT IS"
|
|
15 M=INT(L*RND(0)+1)
|
|
20 INP N
|
|
21 IF N>0 THEN 25
|
|
22 GOSUB70
|
|
23 GOTO1
|
|
25 IF N=M THEN 50
|
|
30 G=G+1
|
|
31 IF N>M THEN 40
|
|
32 PRI "TOO LOW. GUESS AGAIN."
|
|
33 GOTO 20
|
|
40 PRI "TOO HIGH. GUESS AGAIN."
|
|
42 GOTO 20
|
|
50 PRI "THAT'S IT! YOU GOT IT IN"G"TRIES.
|
|
52 IF G<L1 THEN 58
|
|
54 IF G=L1 THEN 60
|
|
56 PRI"YOU SHOULD HAVE BEEN ABLE TO GET IT IN ONLY"L1".
|
|
57 GOT 65
|
|
58 PRI"VERY ";
|
|
60 PRI"GOOD!
|
|
65 GOSUB70
|
|
66 GOTO10
|
|
70 FOR H=1 TO 5
|
|
71 PRI
|
|
72 NEXT H
|
|
73 RETURN
|
|
99 END
|