mirror of
https://github.com/rfivet/BCG101.git
synced 2024-12-23 10:37:15 -05:00
62 lines
1.5 KiB
QBasic
62 lines
1.5 KiB
QBasic
|
2 PRINT:PRINT:PRINT:PRINT "PROGRAM 'WORD'"
|
||
|
3 REM *** WRITTEN BY CHRIS REID, LEXINGTON HS, CLASS OF '73
|
||
|
5 DIM S(7),A(7),L(7),D(7),P(7)
|
||
|
10 PRINT:PRINT "I AM THINKING OF A WORD -- YOU GUESS IT. I WILL GIVE YOU"
|
||
|
15 PRINT "CLUES TO HELP YOU GET IT. GOOD LUCK!!":PRINT:PRINT
|
||
|
20 RANDOMIZE
|
||
|
30 PRINT:PRINT:PRINT "YOU ARE STARTING A NEW GAME..."
|
||
|
35 RESTORE
|
||
|
40 READ N
|
||
|
50 C=INT(RND*N+1)
|
||
|
60 FOR I=1 TO C
|
||
|
70 READ S$
|
||
|
80 NEXT I
|
||
|
90 G=0
|
||
|
100 CHANGE S$ TO S
|
||
|
110 FOR I=1 TO 5
|
||
|
120 A(I)=45
|
||
|
130 NEXT I
|
||
|
140 FOR J=1 TO 5
|
||
|
144 P(J)=0
|
||
|
146 NEXT J
|
||
|
150 PRINT "GUESS A FIVE LETTER WORD";
|
||
|
160 INPUT L$
|
||
|
170 G=G+1
|
||
|
172 IF L$=S$ THEN 500
|
||
|
180 CHANGE L$ TO L
|
||
|
190 IF L(1)=63 THEN 300
|
||
|
200 IF L(0)<>5 THEN 400
|
||
|
205 M=0:Q=1
|
||
|
210 FOR I=1 TO 5
|
||
|
220 FOR J=1 TO 5
|
||
|
230 IF S(I)<>L(J) THEN 260
|
||
|
231 P(Q)=L(J)
|
||
|
232 Q=Q+1
|
||
|
233 IF I<>J THEN 250
|
||
|
240 A(J)=L(J)
|
||
|
250 M=M+1
|
||
|
260 NEXT J
|
||
|
265 NEXT I
|
||
|
270 A(0)=5
|
||
|
272 P(0)=M
|
||
|
275 CHANGE A TO A$
|
||
|
277 CHANGE P TO P$
|
||
|
280 PRINT "THERE WERE"M"MATCHES AND THE COMMON LETTERS WERE...",P$
|
||
|
285 PRINT "FROM THE EXACT LETTER MATCHES, YOU KNOW.............",A$
|
||
|
286 IF A$=S$ THEN 500
|
||
|
287 IF M>1 THEN 289
|
||
|
288 PRINT:PRINT "IF YOU GIVE UP, TYPE '?' FOR YOUR NEXT GUESS"
|
||
|
289 PRINT
|
||
|
290 GOTO 150
|
||
|
300 CHANGE S TO S$
|
||
|
310 PRINT "THE SECRET WORD IS "S$:PRINT
|
||
|
320 GOTO 30
|
||
|
400 PRINT:PRINT "YOU MUST GUESS A 5-LETTER WORD. START AGAIN"
|
||
|
410 PRINT:G=G-1:GOTO 150
|
||
|
500 PRINT "YOU HAVE GUESSED THE WORD. IT TOOK"G"GUESSES!":PRINT
|
||
|
510 INPUT "WANT TO PLAY AGAIN";Q$
|
||
|
520 IF Q$="YES" THEN 30
|
||
|
530 DATA 12,"DINKY","SMOKE","WATER","GRASS","TRAIN","MIGHT","FIRST"
|
||
|
540 DATA "CANDY","CHAMP","WOULD","CLUMP","DOPEY"
|
||
|
999 END
|