100 REM  ======================================================
120 REM  BANKO (FORMERELY CALLED DOUBLE OR NOTHING)
140 REM  AN ORIGINAL GAME BY LANCE MICKLUS OF WINOOSKI, VERMONT
160 REM  TRS-80 LEVEL II/8K VERSION
180 REM  COPYRIGHT SEPTEMBER 1978
200 REM  ======================================================
220 CLEAR 500:RANDOMIZE TIMER
320 CLS
340 E=INT(RND(1)*10000)+1
360 Z=30
380 T=0
400 W=0
420 Q=7
440 VW=12
460 PRINT TAB(23)"WELCOME TO BANKO"
480 PRINT TAB(23)"by Lance Micklus"
500 PRINT TAB(16)"-------------------------------"
520 PRINT
540 PRINT"The game is similar to Black Jack. You draw numbers stopping"
560 PRINT"before the total point value exceeds 11. If you go over 11,"
580 PRINT"then your hand will be zero'd. If you draw 5 times without"
600 PRINT"going over 11, then you'll receive bonus points equal to the"
620 PRINT"value of your hand at the time you end your turn."
640 PRINT
660 PRINT"The score starts at 30 points. If it goes to 60, you win."
680 PRINT"IF IT GOES Below zero, you lose. At the end of each turn, the point"
700 PRINT"difference between the two hands will be added or subtracted"
720 PRINT"from the score."
740 PRINT
800 PRINT"Wish yourself GOOD LUCK, then hit any key when ready to continue.";:B$=INKEY$
820 IF INKEY$="" THEN 820
840 REM
860 REM     THE HUMAN TAKES A TURN
880 REM   --------------------------
900 T=T + 1
920 D=0
940 A(0)=0:A(2)=0
960 CLS
980 PRINT "TYPE Q to QUIT game, D to draw again, S to stay"
1020 PRINT "USER'S TURN"
1040 PRINT"DRAW HAND"
1060 GOSUB 3480
1080 D=D + 1
1100 A(0)=A(0) + N
1110 IF A(0)>11 THEN CLS:GOTO 1120 ELSE 1120
1120 PRINT TAB(20) N;
1140 PRINT TAB(36) A(0);:IF NOT SS THEN 1240
1220 IF N<>A(0) THEN FOR K=0 TO 300:NEXT K
1240 IF A(0)<12 THEN 1320
1260 A(0)=0:A(2)=0
1300 GOTO 1560
1320 PRINT TAB(50)" ";
1340 IF D>4 THEN A(2)=A(0)
1380 O$=INKEY$
1400 IF O$<>"Q" AND O$<>"D" AND O$<>"S" THEN 1380 ELSE PRINT
1420 IF O$="S" THEN 1540
1440 IF O$="Q" THEN 2960
1460 GOTO 1060
1480 REM
1500 REM     DEALER'S TURN
1520 REM   -----------------
1540 CLS
1560 A(1)=0:A(3)=0
1580 D=0
1600 Q=(Q + A(0)) / 2
1620 IF Q<6 THEN Q=6
1640 IF Q>10 THEN Q=10
1660 IF SS THEN FOR K=0 TO 300:NEXT K
1680 PRINT "DEALER'S TURN"
1700 PRINT "DRAW HAND"
1720 GOSUB 3480
1740 A(1)=A(1) + N
1760 D=D + 1
1780 PRINT TAB(20) N;
1800 PRINT TAB(36) A(1):IF NOT SS THEN 1900
1880 IF N<>A(1) THEN FOR K=0 TO 400:NEXT K
1900 IF A(1)<12 THEN 1980
1940 A(1)=0
1960 GOTO 2220
1980 IF D=5 THEN A(3)=A(1):GOTO 2080
2000 IF (D=4) * (A(1)<7) THEN 1720
2020 IF Q<=A(1) THEN 2080
2040 IF A(1) - A(0) - A(2)>Z THEN 2080
2060 GOTO 1720
2080 PRINT "DEALER STAYS"
2120 IF SS THEN FOR K=0 TO 500:NEXT K ELSE FOR K=0 TO 1000:NEXT K
2140 REM
2160 REM     END OF TURNS SEQUENCE
2180 REM   -------------------------
2220 PRINT "SUMMARY #";T
2240 PRINT "User's Hand";A(0);
2260 PRINT "Dealer's Hand";A(1)
2280 PRINT "Bonus Points";A(2);
2300 PRINT "Bonus Points";A(3)
2320 Z=A(0) + A(2) - A(1) - A(3) + Z
2340 PRINT "Score:";Z:IF NOT SS THEN 2520
2520 IF Z>=20 AND Z<=40 THEN W=0:GOTO 2840
2540 IF Z<=0 THEN 3080
2560 IF Z >= 60 THEN 3220
2580 IF W=0 AND Z<10 THEN W=1:GOTO 2640
2600 IF W=0 AND Z>50 THEN W=1:GOTO 2720
2620 GOTO 2840
2640 PRINT "Careful TURKEY, or you're gonna LOSE !!!"
2680 IF SS THEN FOR K=0 TO 750:NEXT K ELSE FOR K=0 TO 1250:NEXT K
2700 GOTO 2840
2740 IF Z=59 THEN B$="POINT" ELSE B$="POINTS"
2780 PRINT "Don't smile yet. You still need";60-Z;B$;" to win!!!"
2820 GOTO 2680
2840 IF SS THEN FOR K=0 TO 750:NEXT K ELSE FOR K=0 TO 1500:NEXT K
2860 GOTO 800
2880 REM
2900 REM     END OF THE GAME.
2920 REM   --------------------
2940 REM
2960 CLS
2980 PRINT "Game ended after";T-1;"turns by SORE LOSER."
3000 PRINT"Dealer WINS by default."
3040 GOTO 3180
3060 REM * DEALER WINS *
3080 PRINT
3100 PRINT"You TURKEY!!!  You LET a stupid computer like me beat you."
3120 PRINT"Better luck next time.";
3180 GOTO 3320
3200 REM * USER WINS *
3220 PRINT
3240 PRINT"Congratulations.  You WON the game."
3260 PRINT"Hope you enjoyed yourself.";
3320 PRINT "Do you want to PLAY AGAIN (Y or N)";:A$=INKEY$
3340 A$=INKEY$:IF A$="" THEN 3340
3360 IF A$<>"N" Z=30:T=0:W=0:GOTO 900
3380 REM  END OF PROGRAM
3400 END
3420 REM
3440 REM     NUMBER GENERATOR
3460 REM   --------------------
3480 IF E>11.9999 THEN E=E / 11.9999:GOTO 3480
3500 N=INT(E)
3520 X=E
3540 L=INT(1.4427 * X) + 1
3560 E=0.693147 * L - X
3580 A=1.32988E-3 - 1.41316E-4 * E
3600 E=(((A - 0.166665) * E - 1) * E + 1)
3620 A=2
3640 IF L<=0 THEN A=0.5:L=-L:IF L=0 THEN RETURN
3660 FOR X=1 TO L
3680 E=A * E
3700 NEXT X
3720 RETURN
3740 REM
3760 REM     FLASH OVER ON THE SCREEN
3780 REM   ----------------------------
3820 PRINT">>> OVER <<<";
3840 FOR K=0 TO 100:NEXT K
3880 FOR K=0 TO 100:NEXT K
3900 NEXT J
3920 RETURN
3940 :REM'
3960 REM LINK TO GAMES MONITOR
3980 END
