Blackjack.bas


Title: backjack
Description: Blackjack. This is an old-style BASIC program.

Category: Games
Copyright: Anonymous
Email:
Created: 1 Jan 2003
Version: 1.0
Sbver: 0.7


'1 REM THIS PROGRAM HAS BEEN MODIFIED TO INCREASE THE BETS
2 REM LINE 340,360 HAVE BEEN CHANGED TO UP THE LIMIT TO 100K
3 REM LINE 345 MODIFIED ALSO LET IT EQUAL THE # OF CHAR THE $ AMT IS
10 PRINT "DO YOU WANT INSTRUCTIONS";
15 INPUT K$
25 IF (LEFT$(K$, 1) <> "Y") AND (LEFT$(K$, 1) <> "y") THEN 85
30 PRINT
35 PRINT
40 PRINT
45 PRINT
50 PRINT "THIS IS A GAME OF BLACKJACK, LAS VEGAS STYLE."
55 PRINT "HERE ARE THE RULES OF THE HOUSE. THE DEALER"
60 PRINT "MUST HIT ON 16 OR LESS AND WILL STAY ON 17 OR"
65 PRINT "MORE. YOU MAY SPLIT TWO CARDS IF THEY ARE THE"
70 PRINT "SAME AND PLAY ONE HAND WITH EACH OF THEM. ALSO,"
75 PRINT "YOU MAY DOUBLE YOUR BET AND RECEIVE EXACTLY ONE "
80 PRINT "MORE CARD ANY TIME ON YOUR FIRST HIT. THE TYPING"
85 PRINT "INSTRUCTIONS ARE: S-STAND; H-HIT; D-DOUBLE; AND"
90 PRINT "P-SPLIT A PAIR."
91 PRINT "THE HOUSE LIMIT IS $100,000"
95 IF K<>1 THEN 155
100 PRINT "WHEN THE DEALER HAS AN EXPOSED ACE HE WILL ASK"
105 PRINT "YOU FOR AN INSURANCE BET. AN INSURANCE BET WILL"
110 PRINT "RISK HALF YOUR BET FOR AN AMOUNT EQUAL TO YOUR BET"
115 PRINT "IF YOU WIN. YOU WIN IF THE DEALER HAS A BLACKJACK"
120 PRINT "AND LOSE IF HE DOESN''T! THE HOUSE LIMIT IS 50,000>"
125 PRINT "GOOD LUCK. OH, BY THE WAY, THE DEALER IS NOTED FOR"
130 PRINT "DEALING OFF THE BOTTOM OF THE DECK. WATCH HIM VERY"
135 PRINT "CLOSELY. HERE HE IS NOW."
140 PRINT
145 PRINT
150 PRINT
155 LET K=0
160 LET W1=0
165 RANDOMIZE
170 LET N=INT(1945*RND+1)
175 PRINT
180 PRINT "ANY TIME YOU WANT ME TO RESHUFFLE THE CARDS SIMPLY"
185 PRINT "TYPE 7777 WHEN I ASK FOR YOUR WAGER AND I''LL BE VERY"
190 PRINT "HAPPY TO OBLIGE. O.K., HERE IS THE FIRST HAND."
200 LET X=INT(10*RND)
210 DIM D(52),E(5),V(5),T(5),WA(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
260 PRINT
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
305 PRINT
310 PRINT
315 PRINT "WAGER";
320 LET P=1
325 INPUT W
330 LET WA(2)=W
335 IF W<=0 THEN 1685
340 IF W<=100000 THEN 370
345 IF W<>7777 THEN 360
350 GOSUB 1645
355 GOTO 315
360 PRINT"HEY THE HOUSE LIMIT IS $100 G ''S"
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";
515 INPUT I$
520 PRINT
525 IF LEFT$(I$, 1) <> "y" 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 "WHAT DO YOU WANT TO DO: (S)TAND (H)IT (D)OUBLE S(P)LIT";
661 INPUT I$: V(1) = -1
662 REM CONVERT SYMBOLIC TO NUMERIC INPUT
666 IF (LEFT$(I$, 1) = "S") OR (LEFT$(i$, 1) = "s") THEN V(1) = 0
667 IF (LEFT$(I$, 1) = "H") OR (LEFT$(I$, 1) = "h") THEN V(1) = 1
668 IF (LEFT$(I$, 1) = "D") OR (LEFT$(I$, 1) = "d") THEN V(1) = 2
669 IF (LEFT$(I$, 1) = "P") OR (LEFT$(I$, 1) = "p") THEN V(1) = 3
670 IF V(1) < 0 THEN PRINT "WHAT ?": GOTO 660
671 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 WA(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 WA(P)=2*WA(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(53*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+WA(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-WA(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 $";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 "MUST BE MY LUCKY DAY."
1615 PRINT
1620 GOTO 1330
1625 PRINT
1630 PRINT "YOU CAN''T BEAT THE BEST."
1635 PRINT
1640 GOTO 1330
1645 PRINT
1650 PRINT "I''M SUPPOSED TO SHUFFLE, BUT I DON''T KNOW HOW!"
1660 PRINT
1665 RETURN
1685 PRINT
1690 PRINT "WELL, SEE YOU NEXT TIME!"
1700 PRINT
1710 END
'