00001 REM TACKER: pngwen (Robert Lowe) 00002 REM DATE: 08-Aug-16 21:15:55 00003 REM CHECKED: BASIC-10 00100 REM PENNEY'S GAME 00110 REM BY ROBERT LOWE (PNGWEN) 8/8/2016 00120 PRINT "WELCOME TO PENNEY'S GAME!" 00130 PRINT "THE FIRST SEQUENCE TO APPEAR IN CONSECUTIVE COINFLIPS WINS!" 00140 PRINT "WE'LL PLAY BEST 3 OUT OF 5." 00150 PRINT "WOULD YOU LIKE TO GO FIRST (Y/N)"; 00160 INPUT G$ 00170 IF LEFT$(G$,1)="Y" OR LEFT$(G$,1)="y" THEN 190 00180 GOTO 400 00190 REM PLAYER GOES FIRST 00200 GOSUB 270 00210 M$=MID$(P$,2,1) 00220 IF M$="H" THEN C$="T" 00230 IF M$="T" THEN C$="H" 00240 C$=C$+LEFT$(P$,2) 00250 PRINT "MY SEQUENCE:";C$ 00260 GOTO 490 00270 REM GET PLAYER SEQUENCE (AND VALIDATE!) 00280 PRINT "USE H AND T TO ENTER A SEQUENCE OF 3 FLIPS" 00290 PRINT "YOUR SEQUENCE"; 00300 INPUT P$ 00310 HC=0 00320 TC=0 00330 FOR I=1 TO LEN(P$) 00340 IF MID$(P$,I,1)="H" THEN HC=HC+1 00350 IF MID$(P$,I,1)="T" THEN TC=TC+1 00360 NEXT I 00370 IF LEN(P$)=3 AND HC+TC=3 THEN RETURN 00380 PRINT "INVALID SEQUENCE. PLEASE TRY AGAIN." 00390 GOTO 280 00400 REM COMPUTER GOES FIRST 00410 C$="" 00420 FOR I=1 TO 3 00430 F=INT(2*RND()+1) 00440 IF F=1 THEN C$=C$+"H" 00450 IF F=2 THEN C$=C$+"T" 00460 NEXT I 00470 PRINT "MY SEQUENCE:";C$ 00480 GOSUB 270 00490 REM PLAY THE GAME 00500 IF P$<>C$ THEN 540 00510 PRINT "HEY! THAT'S MY IDEA!" 00520 GOSUB 270 00530 GOTO 490 00540 PW=0 00550 CW=0 00560 FH$="" 00570 PRINT "YOU:";P$;" VS ME:";C$;" ROUND";PW+CW+1 00580 PRINT " "; 00590 F=INT(2*RND()+1) 00600 IF F=1 THEN F$="H" 00610 IF F=2 THEN F$="T" 00620 PRINT F$; 00630 FH$=FH$+F$ 00640 IF LEN(FH$)>3 THEN FH$=RIGHT$(FH$,3) 00650 IF FH$<>P$ AND FH$<>C$ THEN 590 00660 PRINT "" 00670 IF FH$=P$ THEN 710 00680 PRINT "I WIN THIS ROUND!" 00690 CW=CW+1 00700 GOTO 730 00710 PRINT "YOU WIN THIS ROUND!" 00720 PW=PW+1 00730 PRINT "SCORE YOU:";pw; " ME:";cw 00740 IF PW+CW <> 5 THEN 560 00750 IF PW > CW THEN PRINT "YOU WIN THE GAME!" 00760 IF PW < CW THEN PRINT "I WIN THE GAME!" 00770 PRINT "PLAY AGAIN (Y/N)"; 00780 INPUT G$ 00790 IF MID$(G$,1,1)="Y" THEN 100 00800 IF MID$(G$,1,1)<>"N" THEN 770