home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug055.arc
/
BLACKJK.BAS
< prev
next >
Wrap
BASIC Source File
|
1979-12-31
|
9KB
|
354 lines
1 ' * * * * * B L A C K J A C K * * * * *
2 FOR A = 1 TO 5:
3 PRINT
4 NEXT A:
5 PRINT TAB(20)"B L A C K J A C K ";
6 PRINT " Las Vegas style.":
7 FOR A = 1 TO 9:
8 PRINT
9 NEXT A:
10 PRINT "DO YOU WANT INSTRUCTIONS (Y or N)";
15 INPUT IN$
25 IF IN$ = "N" THEN GOTO 155:
30 FOR A = 1 TO 4
35 PRINT:
40 NEXT A:
50 PRINT TAB(10)"This is the game of BLACKJACK,";
51 PRINT TAB(43)"Las Vegas style.":
52 PRINT
53 PRINT "Here are the rules of the HOUSE :-":
54 PRINT "1. The DEALER must HIT on 16 or less, and STAY";:
55 PRINT " on 17 or more.":
56 PRINT "2. YOU may SPLIT two cards if they are the same";:
57 PRINT ", and play one":
58 PRINT " hand with each of them.":
59 PRINT "3. You may DOUBLE your bet and receive another";:
60 PRINT " card, but only":
61 PRINT " on your first HIT.":
62 PRINT
63 PRINT "Other INSTRUCTIONS are :-":
64 PRINT " 0 - NO HIT; 1 - HIT; 2 - DOUBLE; 4 - ";:
65 PRINT "SPLIT A PAIR.":
66 PRINT:
67 PRINT TAB(40)"HIT ENTER TO CONT...";:
68 INPUT IN$
70 PRINT "General Instructions."
71 PRINT "When the DEALER has an exposed ACE, he will";:
72 PRINT " ask you for an":
73 PRINT "INSURANCE bet. An INSURANCE BET will risk half";:
74 PRINT " of your BET":
75 PRINT "for an amount equal to your bet, IF you WIN.
76 PRINT "You win if the DEALER has a BLACKJACK and ";:
77 PRINT "you lose if he DOESN'T. The House LIMIT is $500.00":
78 PRINT "GOOD LUCK .
79 PRINT
80 PRINT "OH, by the way, the DEALER is noted for dealing";:
81 PRINT " off the bottom":
82 PRINT "of the deck, so WATCH HIM VERY CLOSELY."
135 PRINT" HERE HE IS NOW."
155 LET K=0
160 LET W1=0
170 LET N=INT(1945*RND+1)
175 PRINT
180 PRINT "To reshuffle the deck of cards, type '7777' when";:
185 PRINT " I ask you for":
190 PRINT "for your WAGER, and I will be very HAPPY to oblige."
200 LET X=INT(10*RND)
210 DIM D(52),E(5),V(5),T(5),WIN(5)
215 FOR A=1 TO 52
220 LET D(A)=0
225 NEXT A
230 DIM Q(52)
235 FOR A=0 TO 39 STEP 13
240 FOR C=1 TO 13
245 LET Q(A+C)=C
250 NEXT C
255 NEXT A
265 LET K=K+1
270 FOR P=1 TO 5
275 LET E(P)=0
280 LET V(P)=0
285 LET T(P)=0
290 NEXT P
295 LET V(3)=1
300 PRINT
315 PRINT"WAGER";
320 LET P=1
325 INPUT W
330 LET WIN(2)=W
335 IF W<=0 THEN 1685
340 IF W<=500 THEN 370
345 IF W<>7777 THEN 360
350 GOSUB 1645
355 GOTO 315
360 PRINT"THAT'S TOO MUCH - HOUSE LIMIT IS $500"
365 GOTO 315
370 PRINT
375 PRINT "I SHOW",
380 GOSUB 865
385 IF E(1)=0 THEN 395
390 LET V(4)=1
395 LET V(5)=1
400 GOSUB 865
405 LET M=X
410 LET P=2
415 PRINT"FIRST CARD IS",
420 GOSUB 865
425 LET G=X
430 PRINT"NEXT CARD IS",
435 GOSUB 865
440 IF V(2)>0 THEN 605
445 LET S=X
450 IF V(3)<>1 THEN 605
455 IF T(P)<>21 THEN 505
460 PRINT " ***BLACKJACK*** "
465 PRINT
470 PRINT" THAT'S GETTING A BIT RIDICULOUS::::"
475 PRINT
480 PRINT "MY HOLE CARD WAS ",
485 LET X=M
490 GOSUB 1035
495 LET W1=W1+1.5*W
500 GOSUB 1335
505 IF V(4)=0 THEN 570
510 PRINT"INSURANCE ANYONE (TYPE 1 OR 0, 1 MEANS YES)";
515 INPUT I
520 PRINT
525 IF I=0 THEN 570
530 IF T(1)<>21 THEN 555
535 LET W1=W1+W
540 PRINT
545 PRINT "YOU WIN $";W;"ON YOUR INSURANCE BET"
550 GOTO 570
555 LET W1=W1-W/2
560 PRINT
565 PRINT"YOU LOST $";W/2;"ON YOUR INSURANCE BET,I DON'T HAVE BLACKJACK"
570 IF T(1)<>21 THEN 605
575 PRINT
580 PRINT"**I HAVE BLACKJACK**"
585 PRINT "MY HOLE CARD WAS ",
590 LET X=M
595 GOSUB 1035
600 GOTO 1300
605 IF T(P)<=21 THEN 650
610 IF E(P)>0 THEN 640
615 PRINT"YOU BUSTED, ";
620 PRINT"YOUR TOTAL IS ";T(P)
625 LET C1=T(P)-5*(INT(T(P)/5))
630 IF V(2)=1 THEN 775
635 GOTO 1175
640 LET E(P)=E(P)-1
645 LET T(P)=T(P)-10
650 IF V(1)=2 THEN 620
655 LET V(3)=V(3)+1
660 PRINT"HIT ";
665 INPUT V(1)
670 IF V(1)<>3 THEN 830
675 IF V(2)>0 THEN 820
680 IF V(3)<>2 THEN 820
685 IF Q(G)=Q(S) THEN 700
690 PRINT"NOW IS THAT A PAIR?"
695 GOTO 660
700 LET V(2)=1
705 IF Q(G)<>1 THEN 715
710 LET V(1)=2
715 LET P=3
720 PRINT" PLAY HAND ONE NOW"
725 PRINT"FIRST CARD IS ",
730 LET WIN(3)=W
735 LET X=G
740 GOSUB 750
745 GOTO 430
750 GOSUB 990
755 GOSUB 1035
760 LET V(3)=1
765 LET T(P)=C
770 RETURN
775 LET P=2
780 LET V(2)=2
785 PRINT" PLAY HAND TWO NOW"
790 PRINT"FIRST CARD IS",
795 LET X=S
800 GOSUB 750
805 IF Q(G)=1 THEN 815
810 LET V(1)=0
815 GOTO 430
820 PRINT"NO SPLITS NOW -- TRY AGAIN"
825 GOTO 660
830 IF V(1)<>2 THEN 855
835 IF V(3)=2 THEN 850
840 PRINT"TOO LATE TO DOUBLE, CHARLIE."
845 GOTO 660
850 LET WIN(P)=2*WIN(P)
855 IF V(1)>0 THEN 430
860 GOTO 620
865 GOSUB 900
870 LET T(P)=T(P)+C
875 IF V(5)=0 THEN 890
880 LET V(5)=0
885 RETURN
890 GOSUB 1035
895 RETURN
900 IF R>=50 THEN 945
905 LET N=10*(1+ABS(COS(N+W1)))
910 FOR A=1 TO N
915 LET X=INT(52.99999900000002#*RND)
920 IF X=0 THEN 915
925 NEXT A
930 IF D(X)=0 THEN 980
935 LET R=R+1
940 IF R<50 THEN 900
945 FOR A=1 TO 52
950 IF D(A)=K THEN 960
955 LET D(A)=0
960 NEXT A
965 LET R=0
970 PRINT" I RESHUFFLED ";
975 GOTO 900
980 LET R=0
985 LET D(X)=K
990 IF Q(X)<>1 THEN 1010
995 LET C=11
1000 LET E(P)=E(P)+1
1005 RETURN
1010 IF Q(X)>10 THEN 1025
1015 LET C=Q(X)
1020 RETURN
1025 LET C=10
1030 RETURN
1035 GOSUB 1050
1040 GOSUB 1120
1045 RETURN
1050 IF Q(X)<>1 THEN 1065
1055 PRINT" ACE ";
1060 RETURN
1065 IF Q(X)>10 THEN 1080
1070 PRINT Q(X);" ";
1075 RETURN
1080 IF Q(X)>11 THEN 1095
1085 PRINT " JACK ";
1090 RETURN
1095 IF Q(X)>12 THEN 1110
1100 PRINT" QUEEN ";
1105 RETURN
1110 PRINT" KING ";
1115 RETURN
1120 IF X>39 THEN 1145
1125 IF X>26 THEN 1155
1130 IF X>13 THEN 1165
1135 PRINT"OF SPADES"
1140 RETURN
1145 PRINT"OF CLUBS"
1150 RETURN
1155 PRINT"OF HEARTS"
1160 RETURN
1165 PRINT"OF DIAMONDS"
1170 RETURN
1175 LET P=2
1180 PRINT "MY HOLE CARD WAS ",
1185 LET X=M
1190 GOSUB 1035
1195 IF T(2)<22 THEN 1210
1200 IF V(2)=0 THEN 1300
1205 IF T(3)>21 THEN 1300
1210 LET P=1
1215 IF T(1)<17 THEN 1360
1220 IF T(1)>17 THEN 1230
1225 IF E(1)>0 THEN 1360
1230 IF T(1)>21 THEN 1375
1235 LET P=2
1240 PRINT"MY TOTAL IS ";T(1)
1245 IF T(P)>21 THEN 1300
1250 IF T(1)>21 THEN 1265
1255 IF T(1)>T(P) THEN 1300
1260 IF T(1)=T(P) THEN 1330
1265 LET W1=W1+WIN(P)
1270 IF C1>3 THEN 1445
1275 IF C1>2 THEN 1465
1280 IF C1>1 THEN 1485
1285 IF C1>0 THEN 1505
1290 GOTO 1525
1295 GOTO 1330
1300 LET W1=W1-WIN(P)
1305 IF C1>3 THEN 1545
1310 IF C1>2 THEN 1565
1315 IF C1>1 THEN 1585
1320 IF C1>0 THEN 1605
1325 GOTO 1625
1330 IF V(2)>0 THEN 1345
1335 GOSUB 1405
1340 GOTO 265
1345 LET P=3
1350 LET V(2)=0
1355 GOTO 1245
1360 PRINT "I DRAW",
1365 GOSUB 865
1370 GOTO 1210
1375 IF E(1)=0 THEN 1395
1380 LET E(1)=E(1)-1
1385 LET T(1)=T(1)-10
1390 GOTO 1210
1395 PRINT"I BUSTED *****"
1400 GOTO 1235
1405 IF W1<0 THEN 1425
1410 IF W1=0 THEN 1435
1415 PRINT"YOU'RE AHEAD $";W1
1420 RETURN
1425 PRINT"YOU'RE BEHIND $";ABS(W1)
1430 RETURN
1435 PRINT"YOU'RE EVEN"
1440 RETURN
1445 PRINT
1450 PRINT"I MUST HAVE DEALT WRONG."
1455 PRINT
1460 GOTO 1330
1465 PRINT
1470 PRINT"YOU LUCKED OUT AGAIN:"
1475 PRINT
1480 GOTO 1330
1485 PRINT
1490 PRINT"YOU MUST HAVE BEEN PEEKING."
1495 PRINT
1500 GOTO 1330
1505 PRINT
1510 PRINT"I COULD LOSE MY JOB THIS WAY."
1515 PRINT
1520 GOTO 1330
1525 PRINT
1530 PRINT"THE CARDS HAVE TURNED AGAINST ME:"
1535 PRINT
1540 GOTO 1330
1545 PRINT
1550 PRINT"THE BOTTOM OF THE DECK STRIKES AGAIN:"
1555 PRINT
1560 GOTO 1330
1565 PRINT
1570 PRINT"A VICTORY FOR US GOOD GUYS."
1575 PRINT
1580 GOTO 1330
1585 PRINT
1590 PRINT"YOU CAN'T BEAT SKILL."
1595 PRINT
1600 GOTO 1330
1605 PRINT
1610 PRINT"YOU CAN'T WIN 'EM ALL."
1615 PRINT
1620 GOTO 1330
1625 PRINT
1630 PRINT"BABY GETS A NEW PAIR OF SHOES:"
1635 PRINT
1640 GOTO 1330
1645 FOR M9 = 1 TO 52
1650 LET D(M9)=0
1655 NEXT M9
1660 LET R=0
1665 PRINT
1670 PRINT" I RESHUFFLED"
1675 PRINT""
1680 RETURN
1685 END
ET D(M9)=0
1655 NEXT M9
1660 LET R=0
1665 PRINT
1670 PRINT" I RESHUFFLED"