Trailing-Edge
-
PDP-10 Archives
-
decuslib10-01
-
43,50210/casino.bas
There are no other files named casino.bas in the archive.
10 REM ***DESCRIPTION: THIS PROGRAM WAS WRITTEN BY BOB MCCAW,
20 REM A SENIOR AT LAKESIDE SCHOOL. IT PLAYS ROULETTE, BLACKJACK,
30 REM CHEMIN-DE-FER, CRAPS, AND SLOT MACHINE.
40
50 REM ***INSTRUCTIONS FOR USE: FULL INSTRUCTIONS ARE GIVEN UPON
60 REM REQUEST WHEN THE PROGRAM IS RUN.
70
80 DIM N(60),B(10,36),A(10,36),Q$(13),U$(13),I(25)
90 DEF FNA(X)=INT(X*RND(-1)+1)
100 DEF FNH(X)=ABS(INT(100*X+.5))/100
110 DEF FNR(X)=X-10*INT(X/10)
120 DEF FNI(X)=INT(ABS(X))
130 C(0)=5
140 FOR I=1 TO 5
150 C(I)=7
160 NEXT I
170 CHANGE C TO L$
180 W$=" STANDS WITH __."
190 R$(0)=" .0_."
200 R$(1)=" _.__."
210 R$(2)=" __.__."
220 R$(3)=" ___.__."
230 R$(4)=" ____.__."
240 R$(5)=" _____._0"
250 R$(8)="__."
260 FOR I=1 TO 9
270 READ F$(I)
280 NEXT I
290 FOR I=1 TO 13
300 READ U$(I)
310 NEXT I
320 FOR I=1 TO 13
330 READ Q$(I)
340 NEXT I
350 DATA ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE
360 DATA COL1, COL2, COL3, FIRST 6, SECOND 6, THIRD 6, FOURTH 6
370 DATA FIFTH 6, SIXTH 6, FIRST 12, SECOND 12, THIRD 12, PAIR
380 DATA AN ACE, A TWO, A THREE, A FOUR, A FIVE, A SIX, A SEVEN
390 DATA AN EIGHT, A NINE, A TEN, A JACK, A QUEEN, A KING
400 FOR I=1 TO 60
410 READ N(I)
420 IF I>7 THEN 440
430 READ W$(I)
440 NEXT I
450 RANDOM
460 PRINT "THE CASINO IS NOW OPEN FOR BUSINESS."
470 FOR I=1 TO 5
480 PRINT
490 NEXT I
500 PRINT "THE FOLLOWING GAMES ARE AVAILABLE:"
510 PRINT
520 O$="AND"
530 PRINT "ROULETTE, CRAPS, BLACKJACK, SLOT MACHINE, ";O$;" CHEMIN-DE-FER."
540 I1=I1+1
550 IF I1>1 THEN 830
560 PRINT
570 PRINT "DO YOU NEED INSTRUCTIONS";
580 GOSUB 4120
590 ON V GO TO 630,830,610
600 S3=1
610 PRINT "YES OR NO";
620 GO TO 580
630 PRINT "THE PROGRAM IS USUALLY SELF-EXPLANATORY. HOWEVER--"
640 PRINT " 1. TO CHANGE GAMES, TYPE 'NO ONE' WHEN THE COMPUTER"
650 PRINT " ASKS WHO IS PLAYING. IN TWO PLAYER GAMES,"
660 PRINT " BETTING 0 WILL CHANGE THE GAME. IN ROULETTE, THE "
670 PRINT " GAME IS CHANGED IF NO BETS ARE MADE."
680 PRINT " 2. WHEN THE COMPUTER ASKS FOR MORE THAN ONE"
690 PRINT " BIT OF INFORMATION, SEPARATE THEM BY A COMMA."
700 PRINT " FOR EXAMPLE--"
710 PRINT " NAME,STARTING AMOUNT?BOB,10"
720 PRINT " 3. ALL AMOUNTS OF MONEY YOU INPUT SHOULD BE PLAIN"
730 PRINT " NUMBERS. THE COMPUTER WILL INTERPRET THEM AS"
740 PRINT " DOLLARS AND FRACTIONS OF DOLLARS."
750 PRINT " 4. IF A QUESTION SEEMS OBSCURE, TYPE 'WHAT?'"
760 PRINT " IF THE COMPUTER EXPECTS A WORD, '.001' WHEN"
770 PRINT " THE COMPUTER EXPECTS A NUMBER, OR"
780 PRINT " '.001' FOR THE FIRST NUMBER IF MORE THAN"
790 PRINT " ONE BIT OF INPUT IS EXPECTED."
800 PRINT " FOR EXAMPLE--"
810 PRINT " NAME, STARTING AMOUNT?X,.001"
820 PRINT " WOULD EXPLAIN THAT STATEMENT."
830 PRINT
840 PRINT "WHICH GAME";
850 INPUT I$
860 CHANGE I$ TO I
870 PRINT
880 PRINT
890 IF I(1)=82 THEN 1550
900 IF I(1)=66 THEN 5680
910 IF I(1)=83 THEN 4250
920 IF I(1)=78 THEN 11250
930 IF I(1)<>67 THEN 960
940 IF I(2)=82 THEN 8760
950 IF I(2)=72 THEN 7870
960 O$="OR"
970 GO TO 530
980 REM PLAYER GOSUB
990 IF G8=0 THEN 1240
1000 IF N<2 THEN 1240
1010 PRINT "SAME PLAYERS";
1020 GOSUB 4120
1030 ON V GO TO 1060,1240,1040
1040 PRINT "THE SAME PLAYERS WHO WERE PLAYING THE LAST GAME."
1050 GO TO 1010
1060 IF N=10 THEN 1510
1070 PRINT "ANY ADDITIONAL ONES";
1080 C=0
1090 GOSUB 4120
1100 ON V GO TO 1130,1490,1110
1110 PRINT "ARE THERE ANY ADDITIONAL PLAYERS";
1120 GO TO 1080
1130 C=N
1140 PRINT "HOW MANY";
1150 INPUT N
1160 IF C+N>10 THEN 1210
1170 N=FNI(N)
1180 IF N>0 THEN 1290
1190 PRINT "HOW MANY NEW PLAYERS";
1200 GO TO 1150
1210 PRINT "THERE CANNOT BE MORE THAN 10 PLAYERS."
1220 GO TO 1190
1230 PRINT "THERE CANNOT BE MORE THAN 10 PLAYERS."
1240 PRINT "HOW MANY PLAYERS";
1250 INPUT N
1260 N=FNI(N)
1270 IF N*(N-11)>=0 THEN 1230
1280 C=0
1290 FOR I=1 TO N
1300 PRINT "NAME, STARTING AMOUNT (#";C+I;")";
1310 INPUT A$(C+I),X(C+I)
1320 IF C+I=1 THEN 1360
1330 FOR J=1 TO C+I-1
1340 IF A$(J)=A$(C+I) THEN 1400
1350 NEXT J
1360 IF X(C+I)<=100000 THEN 1420
1370 PRINT "SORRY, WE CAN ONLY LET YOU START WITH $100,000 OR LESS."
1380 PRINT "WHAT SHOULD THE NAME AND AMOUNT BE";
1390 GO TO 1310
1400 PRINT "NAME ALREADY IN USE."
1410 GO TO 1380
1420 IF X(C+I)>.0051 THEN 1460
1430 IF X(C+I)>0 THEN 1520
1440 PRINT "YOU HAVE TO START WITH SOMETHING."
1450 GO TO 1380
1460 X(C+I)=FNH(X(C+I))
1470 Y(C+I)=X(C+I)
1480 NEXT I
1490 G8=0
1500 N=N+C
1510 RETURN
1520 PRINT "TYPE IN THE NAMES AND STARTING AMOUNTS OF MONEY OF THE PLAYERS."
1530 PRINT "A RESPONSE OF 'BOB,10' WOULD GIVE THE PLAYER BOB $10."
1540 GO TO 1290
1550 GOSUB 980
1560 I4=0
1570 IF N=0 THEN 470
1580 GOSUB 4040
1590 FOR I=1 TO N
1600 A(I)=0
1610 B(I)=0
1620 K(I)=0
1630 C(I)=0
1640 S(I)=0
1650 F(I)=1
1660 G(I)=1
1670 H(I)=1
1680 P(I)=0
1690 J$(I)="NO"
1700 PRINT
1710 PRINT "DOES ";A$(I);" WISH TO BET";
1720 GOSUB 4120
1730 ON V GO TO 1760,2270,1740
1740 PRINT "YES OR NO";
1750 GO TO 1720
1760 IF S3>1 THEN 1800
1770 IF J2=1 THEN 1800
1780 GOSUB 10730
1790 PRINT
1800 PRINT "BETS ON EVEN, BLACK, HIGH";
1810 INPUT A(I),B(I),C(I)
1820 IF A(I)=0 THEN 1850
1830 IF ABS(A(I))>.01 THEN 1850
1840 GOSUB 10730
1850 A(I)=FNH(A(I))
1860 B(I)=FNH(B(I))
1870 C(I)=FNH(C(I))
1880 GO TO 1890
1890 S(I)=ABS(A(I))+ABS(B(I))+ABS(C(I))
1900 IF S(I)>X(I)+.001 THEN 3560
1910 IF S(I)<X(I)-.001 THEN 1930
1920 GO TO 2260
1930 PRINT "HOW MANY NUMBERS DOES ";A$(I);" WANT TO BET ON";
1940 INPUT K(I)
1950 IF K(I)=0 THEN 2180
1960 IF K(I)>=1 THEN 1990
1970 GOSUB 10730
1980 GO TO 1930
1990 FOR T=1 TO K(I)
2000 PRINT "WHERE, HOW MUCH";
2010 INPUT A(I,T),B(I,T)
2020 IF A(I,T)=0 THEN 2150
2030 IF ABS(A(I,T))>=.01 THEN 2060
2040 GOSUB 10730
2050 GO TO 2000
2060 A(I,T)=INT(ABS(A(I,T)))
2070 IF A(I,T)>37 THEN 2040
2080 IF B(I,T)>=0 THEN 2110
2090 PRINT "BETS ON NUMBERS MUST BE POSITIVE."
2100 GO TO 2000
2110 B(I,T)=FNH(B(I,T))
2120 S(I)=S(I)+B(I,T)
2130 IF S(I)>X(I)+.001 THEN 3560
2140 IF S(I)<X(I)-.001 THEN 2170
2150 K(I)=T
2160 GO TO 2260
2170 NEXT T
2180 PRINT "ANY OTHER BETS";
2190 INPUT J$(I)
2200 IF J$(I)="YES" THEN 10150
2210 IF J$(I)="NO" THEN 2250
2220 IF J$(I)<>"WHAT" THEN 2180
2230 GOSUB 10730
2240 GO TO 2180
2250 IF S(I)<.01 THEN 2270
2260 I4=1
2270 NEXT I
2280 PRINT
2290 PRINT
2300 IF I4=0 THEN 470
2310 Y=FNA(38)-1
2320 IF Y*(Y-37)=0 THEN 3130
2330 IF Y/2=INT(Y/2) THEN 2390
2340 Z$="ODD"
2350 FOR I=1 TO N
2360 F(I)=-1
2370 NEXT I
2380 GO TO 2400
2390 Z$="EVEN"
2400 ON INT((Y-1)/10)+1 GO TO 2410,2420,2430,2440
2410 ON Y GO TO 2450, 2500, 2450, 2500, 2450,2500, 2450, 2500, 2450, 2500
2420 ON Y-10 GO TO 2500, 2450, 2500, 2450, 2500, 2450, 2500, 2450, 2450, 2500
2430 ON Y-20 GO TO 2450, 2500, 2450, 2500, 2450, 2500, 2450,2500, 2500, 2450
2440 ON Y-30 GO TO 2450, 2500, 2450, 2500, 2450, 2500
2450 Y$="RED"
2460 FOR I=1 TO N
2470 G(I)=-1
2480 NEXT I
2490 GO TO 2510
2500 Y$="BLACK"
2510 IF Y>18 THEN 2570
2520 X$="LOW"
2530 FOR I=1 TO N
2540 H(I)=-1
2550 NEXT I
2560 GO TO 2580
2570 X$="HIGH"
2580 PRINT Y;Y$;", ";Z$;", AND ";X$
2590 PRINT
2600 PRINT
2610 FOR I=1 TO N
2620 T(I)=A(I)*F(I)+B(I)*G(I)+C(I)*H(I)
2630 IF K(I)=0 THEN 2700
2640 FOR J=1 TO K(I)
2650 IF A(I,J)=Y THEN 2680
2660 T(I)=T(I)-B(I,J)
2670 GO TO 2690
2680 T(I)=T(I)+35*B(I,J)
2690 NEXT J
2700 IF J$(I)="YES" THEN 10530
2710 GOSUB 3900
2720 GOSUB 2760
2730 NEXT I
2740 GOSUB 3600
2750 GO TO 1560
2760 REM TOTALER GOSUB
2770 IF ABS(X(I)-Y(I))<1E-3 THEN 2870
2780 IF X(I)-Y(I)<0 THEN 2810
2790 U$="GAIN"
2800 GO TO 2820
2810 U$="LOSS"
2820 PRINT " OVERALL ";U$;"--$";
2830 K=X(I)-Y(I)
2840 GOSUB 2890
2850 PRINT
2860 RETURN
2870 PRINT " BREAKING EVEN."
2880 GO TO 2850
2890 REM FORMAT GOSUB
2900 J=INT(LOG(ABS(K)+.0001)/LOG(10)+1)
2910 K=FNH(K)
2920 IF J>0 THEN 2940
2930 J=0
2940 IF J<7 THEN 2990
2950 IF J=0 THEN 3000
2960 PRINT
2970 PRINT
2980 GO TO 3110
2990 IF K=INT(K) THEN 3090
3000 IF K>.095 THEN 3040
3010 K=100*K
3020 PRINT USING R$(J):K
3030 RETURN
3040 IF K>=1 THEN 3020
3050 J=8
3060 K=100*K
3070 PRINT " .";
3080 GO TO 3020
3090 PRINT K
3100 RETURN
3110 PRINT "YOU BROKE THE BANK!!!!!!!!"
3120 STOP
3130 IF Y=37 THEN 3160
3140 PRINT "0"
3150 GO TO 3170
3160 PRINT "00"
3170 FOR I=1 TO N
3180 T(I)=-S(I)
3190 IF K(I)=0 THEN 3250
3200 FOR J=1 TO K(I)
3210 IF A(I,J)=Y THEN 3240
3220 NEXT J
3230 GO TO 3250
3240 T(I)=T(I)+36*B(I,J)
3250 GOSUB 3900
3260 GOSUB 2760
3270 NEXT I
3280 GOSUB 3600
3290 GO TO 1560
3300 REM BROKE GOSUB
3310 PRINT A$(I);" IS BROKE. DOES HE WANT TO ADD MONEY";
3320 GOSUB 4120
3330 ON V GO TO 3360,3530,3340
3340 PRINT "YES OR NO";
3350 GO TO 3320
3360 PRINT "HOW MUCH";
3370 INPUT X1
3380 IF X1=0 THEN 3530
3390 IF X1<.01 THEN 3500
3400 X(I)=X(I)+X1
3410 Y(I)=Y(I)+X1
3420 IF Y(I)>100000 THEN 3440
3430 RETURN
3440 PRINT "SORRY, ";A$(I);", WE CAN ONLY GIVE YOU CREDIT UP TO $100,000."
3450 PRINT "THAT'S AN ADDITION OF $";
3460 Y(I)=Y(I)-X1
3470 X(I)=X(I)-X1
3480 K=100000-Y(I)
3490 GOSUB 2890
3500 PRINT "HOW MUCH MONEY DOES HE WANT TO ADD";
3510 GO TO 3370
3520 RETURN
3530 F5=F5+1
3540 E(F5)=I
3550 RETURN
3560 K=X(I)
3570 PRINT A$(I);" ONLY HAS $";
3580 GOSUB 2890
3590 GO TO 1600
3600 REM ELIMINATOR GOSUB
3610 IF F5=0 THEN 3810
3620 FOR I=1 TO F5
3630 IF E(I)=N THEN 3780
3640 IF E(I)>P THEN 3660
3650 P=P-1
3660 IF E(I)>D THEN 3680
3670 D=D-1
3680 IF E(I)>S THEN 3700
3690 S=S-1
3700 FOR J=E(I)+1 TO N
3710 A$(J-1)=A$(J)
3720 X(J-1)=X(J)
3730 NEXT J
3740 IF I=F5 THEN 3780
3750 FOR K=1+I TO F5
3760 E(K)=E(K)-1
3770 NEXT K
3780 N=N-1
3790 NEXT I
3800 F5=0
3810 RETURN
3820 REM PLAYER GOSUB
3830 INPUT A$
3840 FOR J9=1 TO N
3850 IF A$(J9)=A$ THEN 3810
3860 NEXT J9
3870 IF A$="NO ONE" THEN 3810
3880 PRINT "WHO";
3890 GO TO 3830
3900 REM TOTAL GOSUB
3910 IF T(I)=0 THEN 4000
3920 X(I)=X(I)+T(I)
3930 X(I)=FNH(X(I))
3940 IF X(I)>1E-3 THEN 3960
3950 GOSUB 3300
3960 PRINT A$(I);" NOW HAS $";
3970 K=X(I)
3980 GOSUB 2890
3990 RETURN
4000 PRINT A$(I);" STILL HAS $";
4010 K=X(I)
4020 GOSUB 2890
4030 RETURN
4040 REM ROUND GOSUB
4050 G8=G8+1
4060 FOR I=1 TO 5
4070 PRINT
4080 NEXT I
4090 PRINT "ROUND";G8
4100 PRINT
4110 RETURN
4120 REM QUESTION-ASKING GOSUB
4130 V=0
4140 INPUT C$
4150 CHANGE C$ TO R
4160 IF R(1)=78 THEN 4220
4170 IF R(1)=89 THEN 4230
4180 IF R(1)=87 THEN 4210
4190 PRINT "WHAT";
4200 GO TO 4140
4210 V=V+1
4220 V=V+1
4230 V=V+1
4240 RETURN
4250 PRINT "DO YOU WANT A TABLE OF PAYOFFS";
4260 GOSUB 4120
4270 ON V GO TO 5580,4280,5580
4280 PRINT "HOW MUCH DO YOU PUT ON EACH SPIN";
4290 INPUT D
4300 D=FNH(D)
4310 IF D<=0 THEN 4280
4320 PRINT
4330 GO TO 4400
4340 PRINT "TRY AGAIN";
4350 GOSUB 4120
4360 ON V GO TO 4390,470,4370
4370 PRINT "ANOTHER SPIN";
4380 GO TO 4350
4390 PRINT
4400 G7=G7+1
4410 A=0
4420 G1=0
4430 F4=0
4440 PRINT "SPIN NO.";G7
4450 PRINT
4460 T=T-D
4470 A(1)=N(FNA(20))
4480 A(2)=N(FNA(20)+20)
4490 A(3)=N(FNA(20)+40)
4500 GO TO 5220
4510 PRINT
4520 K=100*A(1)+10*A(2)+A(3)
4530 ON A(1) GO TO 4540,4590,4640,4690,4740,5050,5150
4540 IF K<120 THEN 4570
4550 P=2*D
4560 GO TO 4860
4570 P=5*D
4580 GO TO 4860
4590 IF K=222 THEN 4620
4600 IF K=227 THEN 4620
4610 GO TO 5160
4620 P=10*D
4630 GO TO 4860
4640 IF K=333 THEN 4670
4650 IF K=337 THEN 4670
4660 GO TO 5160
4670 P=14*D
4680 GO TO 4860
4690 IF K=444 THEN 4720
4700 IF K=447 THEN 4720
4710 GO TO 5160
4720 P=18*D
4730 GO TO 4860
4740 IF K=555 THEN 4770
4750 IF K=557 THEN 4770
4760 GO TO 5160
4770 P=100*D
4780 PRINT
4790 PRINT
4800 FOR I=1 TO 3
4810 PRINT L$;
4820 NEXT I
4830 PRINT "*****JACKPOT*****"
4840 PRINT L$
4850 PRINT
4860 M=P-D
4870 PRINT "YOU WIN $";
4880 K=M
4890 GOSUB 2890
4900 PRINT
4910 T=T+P
4920 IF T<=0 THEN 4950
4930 S$="WON"
4940 GO TO 4970
4950 IF T=0 THEN 5200
4960 S$="LOST"
4970 M=ABS(T)
4980 IF G7=1 THEN 5030
4990 PRINT "AFTER";G7;"SPINS, YOU HAVE ";S$;" $";
5000 K=M
5010 GOSUB 2890
5020 GO TO 4340
5030 PRINT "AFTER 1 SPIN, YOU HAVE ";S$;" $";
5040 GO TO 5000
5050 IF K=666 THEN 5070
5060 GO TO 5160
5070 P=200*D
5080 PRINT
5090 PRINT
5100 FOR I=1 TO 5
5110 PRINT L$;
5120 NEXT I
5130 PRINT "**********DOUBLE JACKPOT**********"
5140 GO TO 4850
5150 IF K=777 THEN 4770
5160 IF A>0 THEN 5380
5170 PRINT "YOU LOSE."
5180 PRINT
5190 GO TO 4920
5200 PRINT "AFTER";G7;"SPINS, YOU ARE BREAKING EVEN."
5210 GO TO 4340
5220 FOR I=1 TO 3
5230 B(I)=0
5240 Z=A(I)
5250 IF A(I)>10 THEN 5290
5260 PRINT W$(Z),
5270 NEXT I
5280 GO TO 4510
5290 B(I)=INT(A(I)/10)
5300 A(I)=A(I)-B(I)*10
5310 A=B(I)
5320 Z=A(I)
5330 PRINT W$(A);" OR ";W$(Z),
5340 F4=F4+1
5350 J(F4)=I
5360 IF I=3 THEN 4510
5370 GO TO 5270
5380 ON F4 GO TO 5390,5420,5170
5390 A(J(F4))=B(J(F4))
5400 A=0
5410 GO TO 4520
5420 IF J(1)=1 THEN 5170
5430 G1=G1+1
5440 ON G1 GO TO 5450,5480,5510
5450 A=A(2)
5460 A(2)=B(2)
5470 GO TO 4520
5480 A(2)=A
5490 A(3)=B(3)
5500 GO TO 4520
5510 A(2)=B(2)
5520 A=0
5530 GO TO 4520
5540 DATA 1,1,2,2,2,2,2,3,3,3,3,3,3,3,47,5,5,6,7,7
5550 DATA 1,1,1,1,1,1,26,52,52,2,2,37,3,3,4,4,4,4,4,7
5560 DATA 52,52,2,2,2,3,3,3,3,4,4,4,4,4,4,4,4,4,5,67
5570 DATA CHERRY,ORANGE,LEMON,MELON,BELL,SEVEN,BAR
5580 PRINT "CHERRY, ANYTHING, ANYTHING PAYS 2."
5590 PRINT "CHERRY, CHERRY, ANYTHING PAYS 5."
5600 PRINT "ORANGE, ORANGE, ORANGE OR BAR PAYS 10."
5610 PRINT "LEMON, LEMON, LEMON OR BAR PAYS 14."
5620 PRINT "MELON, MELON, MELON OR BAR PAYS 18."
5630 PRINT "BELL, BELL, BELL OR BAR PAYS 100. (JACKPOT)"
5640 PRINT "BAR, BAR, BAR PAYS 100. (JACKPOT)"
5650 PRINT "SEVEN, SEVEN, SEVEN PAYS 200. (DOUBLE JACKPOT)"
5660 PRINT
5670 GO TO 4280
5680 GOSUB 980
5690 PRINT
5700 PRINT "DO YOU WANT TO SET THE STAKES";
5710 GOSUB 4120
5720 S1=V
5730 ON V GO TO 5790,7400,5740
5740 PRINT "IF YOU SET THE STAKES, A FIXED AMOUNT WILL BE BET"
5750 PRINT "ON EACH HAND. (SPLIT HANDS MAKE TWO BETS, BUT OTHERWISE)"
5760 PRINT "ALL PAYOFFS ARE AT THE STAKES YOU SET.) IF THE STAKES ARE"
5770 PRINT "NOT SET, BETS ARE MADE ON EACH SEPARATE HAND."
5780 GO TO 5690
5790 PRINT "AT HOW MUCH";
5800 INPUT B
5810 IF B<=0 THEN 5790
5820 IF B<.01 THEN 5860
5830 B=FNH(B)
5840 PRINT
5850 GO TO 7280
5860 PRINT "HOW MUCH WILL BE BET ON EACH HAND";
5870 GO TO 5800
5880 IF P=D THEN 7600
5890 IF B>X(D)+.001 THEN 7710
5900 IF B>X(P)+.001 THEN 7710
5910 FOR I=1 TO 4
5920 GOSUB 7200
5930 NEXT I
5940 IF (D(1)-11)*(D(2)-11)<>0 THEN 5990
5950 IF (D(1)-1)*(D(2)-1)>0 THEN 5990
5960 PRINT "THE DEALER HOLDS ";D$(1);" AND ";D$(2);"."
5970 PRINT " --A BLACKJACK."
5980 GO TO 6930
5990 PRINT A$(D);"'S FACE-UP CARD IS ";D$(2);"."
6000 I=4
6010 IF D(3)=D(4) THEN 6380
6020 GOSUB 6040
6030 GO TO 6680
6040 T2=C(3)+C(4)
6050 IF S2=2 THEN 6070
6060 PRINT A$(P);" HOLDS ";D$(3);" AND ";D$(4);"."
6070 IF (D(3)-1)*(D(4)-1)>0 THEN 6190
6080 IF (D(3)-11)*(D(4)-11)=0 THEN 6120
6090 IF C$<>"YES" THEN 6230
6100 IF D(3)>1 THEN 6230
6110 GO TO 6640
6120 PRINT "BLACKJACK."
6130 W=W+1
6140 RETURN
6150 IF T2>21 THEN 7160
6160 IF I=7 THEN 6330
6170 IF T2>21 THEN 7160
6180 IF T2=21 THEN 6650
6190 FOR C=3 TO I
6200 IF C(C)=1 THEN 6230
6210 NEXT C
6220 IF T2<12 THEN 6280
6230 PRINT "DOES HE WANT ANOTHER CARD";
6240 GOSUB 4120
6250 ON V GO TO 6280,6540,6260
6260 PRINT "YES OR NO";
6270 GO TO 6240
6280 I=I+1
6290 GOSUB 7200
6300 PRINT A$(P);" DRAWS ";D$(I);"."
6310 T2=T2+C(I)
6320 GO TO 6150
6330 PRINT "FIVE CARDS UNDER."
6340 W=W+1
6350 RETURN
6360 GOSUB 3600
6370 GO TO 6950
6380 PRINT A$(P);" HOLDS ";D$(3);" AND ";D$(4);"."
6390 IF X(D)<2*B+.001 THEN 6520
6400 IF X(P)>2*B-.001 THEN 6430
6410 PRINT A$(P);" DOESN'T HAVE ENOUGH MONEY TO SPLIT THEM."
6420 GO TO 6020
6430 PRINT "DOES HE WANT TO SPLIT THEM";
6440 GOSUB 4120
6450 S2=V
6460 ON S2 GO TO 11050,6020,6470
6470 PRINT "IF YOU SPLIT THEM, THEY WILL BE BUILT UP AS TWO SEPARATE"
6480 PRINT "HANDS, WITH THE BET SPECIFIED PLACED ON EACH HAND. YOU ARE"
6490 PRINT "ONLY ONE HIT IF YOU SPLIT ACES. IF YOU STILL DON'T"
6500 PRINT "UNDERSTAND, TYPE 'NO' BECAUSE THIS IS A SUCKER BET ANYWAY."
6510 GO TO 6430
6520 PRINT "THE DEALER DOESN'T HAVE ENOUGH MONEY TO COVER A SPLIT BET."
6530 GO TO 6020
6540 IF T2>11 THEN 6650
6550 FOR J=3 TO I
6560 IF C(J)=1 THEN 6640
6570 NEXT J
6580 GO TO 6650
6590 IF W<>0 THEN 6920
6600 W=SGN(T2-T1-.5)+SGN(T3-T1-.5)
6610 IF W=2 THEN 7100
6620 IF W=-2 THEN 6940
6630 GO TO 6950
6640 T2=T2+10
6650 PRINT A$(P);
6660 PRINT USING W$:T2
6670 RETURN
6680 IF W=-1 THEN 6940
6690 IF W=1 THEN 7100
6700 T1=C(1)+C(2)
6710 PRINT A$(D);" HOLDS ";D$(1);" AND ";D$(2);"."
6720 I=2
6730 P3=(C(1)-1)*(C(2)-1)
6740 IF T1>16 THEN 6880
6750 IF I=2 THEN 6770
6760 P3=P3*(C(I)-1)
6770 IF P3>0 THEN 6830
6780 T1=T1+10
6790 IF T1>21 THEN 6820
6800 IF T1<17 THEN 6820
6810 IF T1>=T2 THEN 6890
6820 T1=T1-10
6830 I=I+1
6840 GOSUB 7200
6850 PRINT A$(D);" DRAWS ";D$(I);"."
6860 T1=T1+C(I)
6870 GO TO 6740
6880 IF T1>21 THEN 7140
6890 PRINT A$(D);
6900 PRINT USING W$:T1
6910 IF S2=1 THEN 6590
6920 IF T1<T2 THEN 7080
6930 W=W-1
6940 PRINT A$(D);" WINS."
6950 PRINT
6960 PRINT
6970 I=D
6980 T(I)=-W*B
6990 GOSUB 3900
7000 GOSUB 2760
7010 I=P
7020 T(I)=W*B
7030 GOSUB 3900
7040 GOSUB 2760
7050 GOSUB 3600
7060 IF N<2 THEN 470
7070 GO TO 7280
7080 IF S2=1 THEN 7120
7090 W=W+1
7100 PRINT A$(P);" WINS."
7110 GO TO 6950
7120 W=W+2-ABS(W)
7130 GO TO 6950
7140 PRINT A$(D);" HAS OVER 21."
7150 GO TO 7080
7160 PRINT A$(P);" HAS OVER 21."
7170 W=W-1
7180 I5=1
7190 RETURN
7200 REM CARD-NAMING GOSUB
7210 C(I)=FNA(13)
7220 C9=C(I)
7230 D(I)=C(I)
7240 D$(I)=Q$(C9)
7250 IF C(I)<11 THEN 7270
7260 C(I)=10
7270 RETURN
7280 IF S1=2 THEN 7400
7290 FOR I=1 TO N
7300 IF B>X(I) THEN 7330
7310 NEXT I
7320 GO TO 7400
7330 PRINT "THE STAKES ARE MORE THAN ONE PLAYER CAN AFFORD."
7340 PRINT "DO YOU WANT TO RESET THEM";
7350 INPUT J$
7360 IF V<3 THEN 5720
7370 PRINT "IF THEY ARE NOT RESET, BETS WILL BE MADE ON EACH HAND"
7380 PRINT "SEPARATELY."
7390 GO TO 7340
7400 GOSUB 4040
7410 U6=N
7420 S2=3
7430 W=0
7440 I9=0
7450 I5=0
7460 D=G8-N*INT(G8/N)
7470 IF D>0 THEN 7490
7480 D=N
7490 PRINT "THE DEALER IS ";A$(D);"."
7500 IF S1=1 THEN 7540
7510 PRINT "MAXIMUM BET: $";
7520 K=X(D)
7530 GOSUB 2890
7540 IF N>2 THEN 7600
7550 P=2/D
7560 I=2
7570 PRINT "THE PLAYER IS ";A$(P);"."
7580 A$=A$(P)
7590 GO TO 7640
7600 PRINT "WHO IS PLAYING";
7610 GOSUB 3820
7620 IF A$="NO ONE" THEN 470
7630 P=J9
7640 IF S1=1 THEN 5880
7650 PRINT "HOW MUCH DOES HE BET";
7660 INPUT B
7670 IF B=0 THEN 470
7680 IF B>0 THEN 5880
7690 PRINT "HOW MUCH DOES THE LOSER OF THE HAND PAY THE WINNER";
7700 GO TO 7660
7710 IF B>X(D) THEN 7740
7720 Q3=X(P)
7730 GO TO 7750
7740 Q3=X(D)
7750 PRINT "THE MOST THAT ";A$(P);" CAN BET IS $";
7760 K=Q3
7770 GOSUB 2900
7780 GO TO 7650
7790 I=P
7800 GOSUB 3300
7810 IF X(I)>0 THEN 7030
7820 GO TO 7030
7830 I=D
7840 GOSUB 3300
7850 IF X(I)>0 THEN 7030
7860 GO TO 6360
7870 GOSUB 980
7880 D=1
7890 GOSUB 4040
7900 PRINT A$(D);" IS THE BANKER."
7910 PRINT "WHAT IS THE BANK";
7920 INPUT B
7930 IF B=0 THEN 470
7940 IF B>X(D) THEN 8560
7950 IF N>2 THEN 7990
7960 P=2/D
7970 PRINT A$(P);" IS THE PLAYER."
7980 GO TO 8040
7990 PRINT "WHO IS PLAYING";
8000 GOSUB 3820
8010 IF A$="NO ONE" THEN 470
8020 IF J9=D THEN 7990
8030 P=J9
8040 PRINT "HOW MUCH DOES ";A$(P);" BET";
8050 INPUT M
8060 IF N=2 THEN 8080
8070 PRINT
8080 IF M>B THEN 8540
8090 IF M>X(P) THEN 10110
8100 FOR I=1 TO 4
8110 GOSUB 7200
8120 NEXT I
8130 C(5)=0
8140 C(6)=0
8150 IF FNR(C(1)+C(2))>7 THEN 8440
8160 IF FNR(C(3)+C(4))>7 THEN 8500
8170 PRINT A$(P);" HOLDS ";D$(3);" AND ";D$(4);"."
8180 IF FNR(C(3)+C(4))<5 THEN 8230
8190 IF FNR(C(3)+C(4))>5 THEN 8270
8200 PRINT "DOES ";A$(P);" WANT ANOTHER CARD";
8210 GOSUB 4120
8220 ON V GO TO 8230,8270,8200
8230 I=5
8240 GOSUB 7200
8250 PRINT A$(P);" DRAWS ";D$(5);"."
8260 GO TO 8270
8270 PRINT A$(D);" HOLDS ";D$(1);" AND ";D$(2);"."
8280 IF FNR(C(1)+C(2))>=FNR(C(3)+C(4)+C(5)) THEN 8390
8290 I=6
8300 GOSUB 7200
8310 PRINT A$(D);" DRAWS ";D$(6);"."
8320 IF FNR(C(1)+C(2)+C(6))>=FNR(C(3)+C(4)+C(5)) THEN 8390
8330 PRINT A$(P);" WINS."
8340 T(D)=-M
8350 T(P)=M
8360 GO TO 8580
8370 PRINT "NO WINNER."
8380 GO TO 8100
8390 IF FNR(C(1)+C(2)+C(6))=FNR(C(3)+C(4)+C(5)) THEN 8370
8400 PRINT A$(D);" WINS."
8410 T(D)=M
8420 T(P)=-M
8430 GO TO 8580
8440 PRINT A$(D);" HOLDS ";D$(1);" AND ";D$(2);"."
8450 Q=FNR(C(1)+C(2))
8460 PRINT " --A NATURAL ";F$(Q)
8470 IF FNR(C(3)+C(4))>FNR(C(1)+C(2)) THEN 8500
8480 PRINT A$(P);" HOLDS ";D$(3);" AND ";D$(4);"."
8490 GO TO 8390
8500 PRINT A$(P);" HOLDS ";D$(3);" AND ";D$(4);"."
8510 Q=FNR(C(3)+C(4))
8520 PRINT " --A NATURAL ";F$(Q)
8530 GO TO 8330
8540 PRINT "THERE IS ONLY $";B;"IN THE BANK."
8550 GO TO 8040
8560 PRINT A$(D);" DOESN'T HAVE THAT MUCH."
8570 GO TO 7910
8580 I=D
8590 GOSUB 3900
8600 GOSUB 2760
8610 I=P
8620 GOSUB 3900
8630 GOSUB 2760
8640 GOSUB 3600
8650 IF D>0 THEN 8680
8660 D=1
8670 GO TO 7890
8680 IF N<2 THEN 470
8690 IF T(D)<0 THEN 8710
8700 GO TO 7890
8710 D=D+1
8720 IF D<=N THEN 7890
8730 D=D-N
8740 GO TO 7890
8750 GO TO 560
8760 GOSUB 980
8770 I4=0
8780 S1=2
8790 GOSUB 4040
8800 FOR I=1 TO N
8810 F(I)=0
8820 NEXT I
8830 IF I4=1 THEN 8880
8840 PRINT "WHO IS SHOOTING";
8850 GOSUB 3820
8860 IF A$="NO ONE" THEN 470
8870 S=J9
8880 IF S1=1 THEN 8930
8890 PRINT "HOW MUCH DOES HE WANT TO SHOOT";
8900 INPUT B
8910 IF B<.01 THEN 11030
8920 B=FNH(B)
8930 F(S)=-B
8940 R=B
8950 IF B>X(S) THEN 10070
8960 FOR I=1 TO N
8970 IF I=S THEN 9140
8980 PRINT "HOW MUCH DOES ";A$(I);" WANT TO FADE";
8990 INPUT F(I)
9000 IF F(I)>R+.001 THEN 10030
9010 IF F(I)>X(I)+.001 THEN 9990
9020 IF F(I)=0 THEN 9140
9030 IF F(I)<.01 THEN 9120
9040 R=R-F(I)
9050 IF R>1E-4 THEN 9140
9060 PRINT "THE BET IS COVERED."
9070 IF I=N THEN 9210
9080 IF I<N-1 THEN 9100
9090 IF S=N THEN 9210
9100 PRINT "THE REMAINING PLAYERS CAN BET AGAINST THE HOUSE LATER."
9110 GO TO 9210
9120 PRINT "HOW MUCH OF ";A$(S);"'S BET DOES ";A$(I);" WANT TO COVER";
9130 GO TO 8990
9140 NEXT I
9150 IF R=B THEN 470
9160 B=B-R
9170 F(S)=-B
9180 PRINT A$(S);" WILL HAVE TO BE CONTENT WITH A BET OF $";
9190 K=B
9200 GOSUB 2900
9210 PRINT
9220 L1=FNA(6)
9230 L2=FNA(6)
9240 I4=0
9250 PRINT F$(L1);" AND ";F$(L2)
9260 G=L1+L2
9270 IF (G-7)*(G-11)=0 THEN 9580
9280 IF (G-2)*(G-3)*(G-12)=0 THEN 9620
9290 PRINT A$(S)"'S POINT IS";G
9300 FOR I=1 TO N
9310 IF F(I)>0 THEN 9430
9320 IF I=S THEN 9430
9330 PRINT "HOW MUCH DOES ";A$(I);" BET HE MAKES IT";
9340 INPUT F(I)
9350 IF F(I)<0 THEN 9330
9360 IF F(I)*(F(I)-.01)>=0 THEN 9420
9370 PRINT "IF A BET IS MADE, AND ";A$(S);" MAKES HIS POINT,"
9380 PRINT "YOUR BET WILL PAY AT EVEN MONEY IF THE POINT IS 4 OR 8,"
9390 PRINT "AT 4 TO 3 IF IT IS 5 OR 9, AT 5 TO 3 IF IT IS 4 OR 10>"
9400 PRINT "YOU MAY BET 0."
9410 GO TO 9330
9420 F(I)=-F(I)
9430 NEXT I
9440 L3=FNA(6)
9450 L4=FNA(6)
9460 PRINT F$(L3);" AND ";F$(L4)
9470 H=L3+L4
9480 IF H=7 THEN 9510
9490 IF H=G THEN 9540
9500 GO TO 9440
9510 PRINT A$(S);" CRAPS OUT."
9520 PRINT
9530 GO TO 9700
9540 PRINT A$(S);" MAKES HIS POINT."
9550 PRINT
9560 GOSUB 9890
9570 GO TO 9700
9580 PRINT "A NATURAL."
9590 PRINT
9600 GOSUB 9890
9610 GO TO 9700
9620 PRINT "CRAPS, ";A$(S);" LOSES."
9630 IF G=3 THEN 9690
9640 PRINT "OTHER BETS ARE WITHDRAWN."
9650 FOR I=1 TO N
9660 IF I=S THEN 9680
9670 F(I)=0
9680 NEXT I
9690 PRINT
9700 FOR I=1 TO N
9710 T(I)=F(I)
9720 GOSUB 3900
9730 GOSUB 2760
9740 NEXT I
9750 GOSUB 3600
9760 IF N<2 THEN 470
9770 IF I4=0 THEN 8780
9780 PRINT "THE SHOOTER PASSES."
9790 PRINT "DOES HE WANT TO LET THE BET RIDE";
9800 GOSUB 4120
9810 S1=V
9820 ON V GO TO 9840,8790,9860
9830 IF Y$="NO" THEN 8790
9840 B=2*B
9850 GO TO 8790
9860 PRINT "DO YOU WANT TO BET YOUR BET ON THE LAST ROUND PLUS"
9870 PRINT "YOUR WINNINGS";
9880 GO TO 9800
9890 FOR I=1 TO N
9900 IF I=S THEN 9930
9910 IF F(I)>0 THEN 9930
9920 F(I)=-FNH((ABS(G-7)+2)*F(I)/3)
9930 F(I)=-F(I)
9940 NEXT I
9950 I4=1
9960 RETURN
9970 PRINT A$(I);", YOU DON'T HAVE THAT MUCH."
9980 GO TO 9330
9990 PRINT A$(I);" ONLY HAS $";
10000 K=X(I)
10010 GOSUB 2900
10020 GO TO 8980
10030 PRINT "MAXIMUM FADE: $";
10040 K=R
10050 GOSUB 2900
10060 GO TO 8980
10070 PRINT A$(S);" ONLY HAS $";
10080 K=X(S)
10090 GOSUB 2900
10100 GO TO 8890
10110 PRINT A$(P);" ONLY HAS $";
10120 K=X(P)
10130 GOSUB 2900
10140 GO TO 8040
10150 PRINT "HOW MANY";
10160 INPUT P(I)
10170 IF P(I)<1 THEN 2250
10180 FOR J=1 TO P(I)
10190 PRINT "WHAT BET, HOW MUCH";
10200 INPUT Z$(J),Z(I,J)
10210 IF Z(I,J)>=.01 THEN 10240
10220 GOSUB 10730
10230 GO TO 10190
10240 FOR K=1 TO 13
10250 IF U$(K)=Z$(J) THEN 10290
10260 NEXT K
10270 PRINT "THE BET ";Z$(J);" DOESN'T EXIST."
10280 GO TO 10190
10290 Y(I,J)=K
10300 S(I)=S(I)+ABS(Z(I,J))
10310 IF X(I)<S(I)-.001 THEN 3560
10320 IF S(I)<X(I)+.001 THEN 10350
10330 P(I)=J
10340 GO TO 2260
10350 IF K=13 THEN 10380
10360 NEXT J
10370 GO TO 2260
10380 PRINT "WHAT NUMBERS";
10390 INPUT P(I,J),Q(I,J)
10400 P(I,J)=FNI(P(I,J))
10410 Q(I,J)=FNI(Q(I,J))
10420 D=ABS(P(I,J)-Q(I,J))
10430 P(I,J)=(P(I,J)+Q(I,J)-D)/2
10440 Q(I,J)=P(I,J)+D
10450 IF Q(I,J)>37 THEN 10510
10460 IF P(I,J)/3=INT(P(I,J)/3) THEN 10480
10470 IF D=1 THEN 10360
10480 IF D=3 THEN 10360
10490 PRINT "NUMBERS ARE NOT ADJACENT."
10500 GO TO 10380
10510 PRINT "THE NUMBER";Q(I,J);"DOESN'T EXIST."
10520 GO TO 10380
10530 IF P(I)=0 THEN 2710
10540 FOR J=1 TO P(I)
10550 IF Y(I,J)>3 THEN 10590
10560 IF (Y-Y(I,J))/3>INT((Y-Y(I,J))/3) THEN 10700
10570 T(I)=T(I)+2*Z(I,J)
10580 GO TO 10710
10590 IF Y(I,J)>9 THEN 10630
10600 IF (Y-6*Y(I,J)+24)*(Y-6*Y(I,J)+17)>=0 THEN 10700
10610 T(I)=T(I)+5*Z(I,J)
10620 GO TO 10710
10630 IF Y(I,J)=13 THEN 10670
10640 IF (Y-12*Y(I,J)+120)*(Y-12*Y(I,J)+107)>=0 THEN 10700
10650 T(I)=T(I)+2*Z(I,J)
10660 GO TO 10710
10670 IF (P(I,J)-Y)*(Q(I,J)-Y)<>0 THEN 10700
10680 T(I)=T(I)+17*Z(I,J)
10690 GO TO 10710
10700 T(I)=T(I)-Z(I,J)
10710 NEXT J
10720 GO TO 2710
10730 REM ROULETTE EXPLANATION GOSUB
10740 IF J2=1 THEN 10800
10750 PRINT "DO YOU WANT AN EXPLANATION OF ROULETTE BETS";
10760 GOSUB 4120
10770 ON V GO TO 10820,10810,10780
10780 PRINT "YES OR NO";
10790 GO TO 10760
10800 PRINT "READ YOUR EXPLANATION."
10810 RETURN
10820 PRINT "THERE ARE THREE SETS OF BETS IN ROULETTE."
10830 PRINT " 1. BETS ON EVEN, BLACK, HIGH."
10840 PRINT " INPUT THREE NUMBERS. TO BET ON RED, ODD, OR LOW"
10850 PRINT " BET A NEGATIVE AMOUNT. FOR EXAMPLE--"
10860 PRINT " -1,0,2 WOULD PUT $1 ON ODD AND $2 ON HIGH."
10870 PRINT " 2. BETS ON NUMBERS. THE COMPUTER ASKS"
10880 PRINT " MANY NUMBERS YOU WANT TO BET ON. IF YOU BET"
10890 PRINT " ON SOME, THE COMPUTER WILL TYPE 'WHERE, HOW MUCH?'"
10900 PRINT " TYPE IN THE NUMBER THE BET IS ON FOLLOWED BY THE BET."
10910 PRINT " FOR EXAMPLE--"
10920 PRINT " 3,5 WOULD PUT $5 ON NUMBER 3."
10930 PRINT " 3. OTHER BETS. ONCE YOU GET PAST PRELIMINARY QUESTIONS,"
10940 PRINT " THE COMPUTER WILL ASK 'WHAT BET, HOW MUCH?'"
10950 PRINT " AVAILABLE BETS ARE COL1, COL2, COL3, FIRST 6,"
10960 PRINT " ..., SIXTH 6, FIRST 12, SECOND 12, THIRD 12, PAIR."
10970 PRINT " A RESPONSE OF 'COL1,10' WOULD PUT $10 ON COLUMN 1."
10980 PRINT " 'PAIR, 10' WOULD CAUSE THE COMPUTER TO ASK 'WHAT NUMBERS?'"
10990 PRINT " TYPE IN THE NUMBERS YOU WANT TO BET ON."
11000 PRINT " AS IN REGULAR ROULETTE, THE NUMBERS MUST BE ADJACENT."
11010 J2=1
11020 RETURN
11030 PRINT "HOW MUCH DOES HE BET ON THIS ROUND";
11040 GO TO 8900
11050 I=4
11060 C(I)=FNA(13)
11070 GOSUB 7200
11080 PRINT "FIRST HAND"
11090 GOSUB 6040
11100 IF W<>0 THEN 11130
11110 T3=T2
11120 I9=1
11130 I=4
11140 C(I)=FNA(13)
11150 GOSUB 7200
11160 PRINT "SECOND HAND"
11170 GOSUB 6040
11180 IF T2<=21 THEN 11210
11190 IF I9=0 THEN 11210
11200 T2=T3
11210 IF I5=0 THEN 11230
11220 IF W=0 THEN 6950
11230 IF ABS(W)=2 THEN 6950
11240 GO TO 6700
11250 END