1
0
mirror of https://github.com/rfivet/BCG101.git synced 2024-12-23 10:37:15 -05:00
BCG101/port/23MTCH.BAS

46 lines
1.2 KiB
QBasic

100 REM ***23 MATCHES
105 RANDOMIZE
110 PRINT "LET'S PLAY 23 MATCHES. WE START WITH 23 MATCHES."
115 PRINT "YOU MOVE FIRST. YOU MAY TAKE 1,2 OR 3 MATCHES."
120 PRINT "THEN I MOVE...I MAY TAKE 1,2 OR 3 MATCHES."
125 PRINT "YOU MOVE, I MOVE AND SO ON. THE ONE WHO HAS TO"
130 PRINT "TAKE THE LAST MATCH LOSES."
135 PRINT "GOOD LUCK AND MAY THE BEST COMPUTER (HA HA) WIN."
140 PRINT
150 LET M=23
200 REM ***THE HUMAN MOVES
205 PRINT
210 PRINT "THERE ARE NOW";M;"MATCHES."
215 PRINT
220 PRINT "HOW MANY DO YOU TAKE";
230 INPUT H
240 IF H>M THEN 510
250 IF H<>INT(H) THEN 510
260 IF H<=0 THEN 510
270 IF H>=4 THEN 510
280 LET M=M-H
290 IF M=0 THEN 410
300 REM ***THE COMPUTER MOVES
305 IF M=1 THEN 440
310 LET R=M-4*INT(M/4)
320 IF R<>1 THEN 350
330 LET C=INT(3*RND(0))+1
340 GO TO 360
350 LET C=(R+3)-4*INT((R+3)/4)
360 LET M=M-C
370 IF M=0 THEN 440
375 PRINT
380 PRINT "I TOOK";C;"...";
390 GO TO 210
400 REM ***SOMEBODY WON (SEE LINES 290,305,370)
410 PRINT
420 PRINT "I WON!!! BETTER LUCK NEXT TIME."
430 GO TO 140
440 PRINT
450 PRINT "O.K. SO YOU WON. LET'S PLAY AGAIN."
460 GO TO 140
500 REM ***THE HUMAN CHEATED! (SEE LINES 240 THRU 270)
510 PRINT "YOU CHEATED! BUT I'LL GIVE YOU ANOTHER CHANCE."
520 GO TO 215
999 END