1 2 PRINT
2 3 PRINT" BLKJAK"
3 4 PRINT
4 20 DIM W10,E10,T10,V10
5 24 PRINT"This demonstration shows the versatility of the Multics"
6 26 PRINT"BASIC languague by simulating a game of Blackjack."
7 27 PRINT" "
8 28 PRINT"DO YOU NEED INSTRUCTIONS 1=YES 0=NO"
9 29 INPUT k
10 30 IF K=0 THEN 112
11 32 PRINT"HERE ARE THE LAS VEGAS RULES FOR PLAYING BLACKJACK:"
12 34 PRINT
13 36 PRINT">WAGER: THE HOUSE LIMIT IS $500, SO TYPE IN A NUMBER "
14 38 PRINT" FROM 0 TO 500. TO TERMINATE GAME, ENTER ZERO."
15 40 PRINT
16 42 PRINT">THE DEAL: I DEAL MYSELF 2 CARDS AND SHOW YOU ONE. THEN I"
17 44 PRINT" DEAL YOU TWO CARDS, AND ASK IF YOU WANT A HIT ANOTHER"
18 46 PRINT" CARD. YOU HAVE SEVERAL OPTIONS DEPENDING ON THE CARDS"
19 48 PRINT" YOU HOLD AND MY UP CARD:"
20 50 PRINT" * STAND - BY TYPING A ZERO"
21 52 PRINT" * TAKE A HIT - BY TYPING A ONE"
22 54 PRINT" * GO DOWN FOR DOUBLES - BY TYPING A TWO"
23 56 PRINT" * SPLIT A PAIR - BY TYPING A THREE"
24 58 PRINT
25 60 PRINT">INSURANCE: IF MY UP CARD IS AN ACE, I WILL ASK IF YOU"
26 62 PRINT" WANT INSURANCE. IF YOU DO TYPE A ONE, BETTING ONE-HALF"
27 64 PRINT" OF YOUR WAGER THAT I DO HAVE BLACKJACK. IF I DO, I PAY"
28 66 PRINT" 2-TO-1 ON YOUR INSURANCE BET. YOU LOSE YOUR ORIGINAL WAGER"
29 68 PRINT" SINCE I HAVE BLACKJACK, SO WE ARE EVEN FOR THE HAND."
30 70 PRINT" IF I DON'T HAVE BLACKJACK, YOU LOSE YOUR INSURANCE BET"
31 72 PRINT" AND THE GAME CONTINUES. "
32 74 PRINT
33 76 PRINT" IF YOU REFUSE INSURANCE BY TYPING A ZERO THE GAME"
34 78 PRINT" CONTINUES AS NORMAL."
35 80 PRINT
36 82 PRINT">THE PLAY: WHEN YOU FINALLY STAND BY TYPING A ZERO"
37 84 PRINT" I WILL DRAW CARDS UNTIL:"
38 86 PRINT" *I HAVE AT LEAST A HARD 17 HARD MEANS THE TOTAL"
39 88 PRINT" DOES NOT INCLUDE AN ACE BEING COUNTED AS 11"
40 90 PRINT" *I HAVE A SOFT 18 SOFT MEANS THE TOTAL INCLUDES AN"
41 92 PRINT" ACE COUNTED AS 11"
42 94 PRINT" *I REACH A TOTAL OF 21"
43 96 PRINT" *I EXCEED 21 AND BUST"
44 98 PRINT
45 100 PRINT">ITEMS:"
46 102 PRINT" *I PAY 1.5-TO-1 ON BLACKJACK"
47 104 PRINT" *I DON'T RECOGNIZE 5-CARDS-AND-UNDER"
48 106 PRINT" *YOU MAY DOUBLE DOWN ON A SPLIT HAND"
49 108 PRINT" *YOU DON'T LOSE ON A TIE HAND...WE PUSH"
50 110 PRINT" <<<GOOD LUCK>>>"
51 112 PRINT"MULTICS IS THE DEALER AND GETS A BREAK AT 1945 HOURS. WHAT"
52 113 randomize
53 114 PRINT"TIME IS IT NOW";
54 116 LET K=0
55 118 LET W1=0
56 120 INPUT N
57 122 FOR I = 1TO N/2
58 124 let x=t10*rnd
59 126 NEXT I
60 128 DIM D52
61 130 FOR A=1 TO 52
62 132 LET DA = 0
63 134 NEXT A
64 136 DIM Q52
65 138 FOR A=0 TO 39 STEP 13
66 140 FOR C=1 TO 13
67 142 LET QA+C=C
68 144 NEXT C
69 146 NEXT A
70 148 PRINT
71 150 LET K=K+1
72 152 FOR P=1 TO 5
73 154 LET EP=0
74 156 LET VP = 0
75 158 LET TP=0
76 160 NEXT P
77 162 LET V3=1
78 164 PRINT
79 166 PRINT "WAGER";
80 168 LET P=1
81 170 INPUT W
82 172 LET W2=W
83 174 IF W<=0 THEN 582
84 176 IF W<=500 THEN 182
85 178 PRINT "THAT'S TOO MUCH - HOUSE LIMIT IS $500."
86 180 GOTO 166
87 182 PRINT
88 184 PRINT "I SHOW ",
89 186 GOSUB 366
90 188 IF E1=0 THEN 192
91 190 LET V4=1
92 192 LET V5=1
93 194 GOSUB 366
94 196 LET M=X
95 198 LET P=2
96 200 PRINT "FIRST CARD IS",
97 202 GOSUB 366
98 204 LET G=X
99 206 PRINT "NEXT CARD IS",
100 208 GOSUB 366
101 210 IF V2>0 THEN 262
102 212 LET S=X
103 214 IF V3<>1 THEN 262
104 216 IF TP<>21 THEN 230
105 218 PRINT "***BLACKJACK***"
106 220 PRINT "MY HOLE CARD WAS ",
107 222 LET X=M
108 224 GOSUB 434
109 226 LET W1=W1+1.5*W
110 228 GOTO 538
111 230 IF V4=0 THEN 250
112 232 PRINT "INSURANCE ANYONE TYPE 1 OR 0";
113 234 INPUT I
114 236 IF I=0 THEN 250
115 238 IF T1<>21 THEN 246
116 240 LET W1=W1+W
117 242 PRINT "YOU WIN $";W;" ON YOUR INSURANCE BET";
118 244 GOTO 250
119 246 LET W1=W1-W/2
120 248PRINT"YOU LOST $";W/2;" ON INSURANCE BET - I DONT HAVE BLKJAK"
121 250 IF T1<>21 THEN 262
122 252 PRINT "**I HAVE BLACKJACK**"
123 254 PRINT "MY HOLE CARD IS ",
124 256 LET X=M
125 258 GOSUB 434
126 260 GOTO 534
127 262 IF TP<=21 THEN 278
128 264 IF EP>0 THEN 274
129 266 PRINT "YOU BUSTED, ";
130 268 PRINT "YOUR TOTAL IS ";TP
131 270 IF V2=1 THEN 328
132 272 GOTO 494
133 274 LET EP=EP-1
134 276 LET TP=TP-10
135 278 IF V1=2 THEN 268
136 280 LET V3=V3+1
137 282 PRINT "HIT";
138 284 INPUT V1
139 286 IF V1<>3 THEN 350
140 288 IF V2>0 THEN 346
141 290 IF V3<>2 THEN 346
142 292 IF QG=QS THEN 298
143 294 PRINT "NOW IS THAT A PAIR "
144 296 GOTO 282
145 298 LET V2=1
146 300 IF QG<>1 THEN 304
147 302 LET V1=2
148 304 LET P=3
149 306 PRINT " PLAY HAND ONE NOW"
150 308 PRINT "FIRST CARD IS",
151 310 LET W3=W
152 312 LET X=G
153 314 GOSUB 318
154 316 GOTO 206
155 318 GOSUB 414
156 320 GOSUB 434
157 322 LET V3=1
158 324 LET TP=C
159 326 RETURN
160 328 LET P=2
161 330 LET V2=2
162 332 PRINT " PLAY HAND TWO NOW"
163 334 PRINT "FIRST CARD IS",
164 336 LET X=S
165 338 GOSUB 318
166 340 IF QG=1 THEN 344
167 342 LET V1=0
168 344 GOTO 206
169 346 PRINT "NO SPLITS NOW -- TRY AGAIN"
170 348 GOTO 282
171 350 IF V1<>2 THEN 360
172 352 IF V3=2 THEN 358
173 354 PRINT "TOO LATE TO DOUBLE, CHARLIE."
174 356 GOTO 282
175 358 LET WP=2*WP
176 360 IF V1>0 THEN 206
177 362 GOTO 268
178 364 REM DEAL
179 366 GOSUB 380
180 368 LET TP=TP+C
181 370 IF V5=0 THEN 376
182 372 LET V5=0
183 374 RETURN
184 376 GOSUB 434
185 378 RETURN
186 380 LET N=10 *1+ABSCOSN+W1
187 382 FOR A=1 TO N
188 384 let x=int52.9999999*rnd
189 386 IF X=0 THEN 384
190 388 NEXT A
191 390 IF DX=0 THEN 410
192 392 LET R=R+1
193 394 IF R<50 THEN 380
194 396 FOR A=1 TO 52
195 398 IF DA =K THEN 402
196 400 LET DA=0
197 402 NEXT A
198 404 LET R=0
199 406 PRINT "I RESHUFFLED"
200 408 GOTO 380
201 410 LET R=0
202 412 LET DX=K
203 414 IF QX<>1 THEN 422
204 416 LET C=11
205 418 LET EP=EP+1
206 420 RETURN
207 422IF QX>10 THEN 428
208 424 LET C=QX
209 426 RETURN
210 428 LET C=10
211 430 RETURN
212 432 REM PRINT CARD
213 434 GOSUB 440
214 436 GOSUB 470
215 438 RETURN
216 440 IF QX<>1 THEN 446
217 442 PRINT " ACE ";
218 444 RETURN
219 446 IF QX>10 THEN 452
220 448 PRINT QX;
221 450 RETURN
222 452 IF QX>11 THEN 458
223 454 PRINT " JACK ";
224 456 RETURN
225 458 IF QX>12 THEN 464
226 460 PRINT " QUEEN ";
227 462 RETURN
228 464 PRINT " KING ";
229 466 RETURN
230 468 REM PRINT SUIT
231 470 IF X>39 THEN 480
232 472 IF X>26 THEN 484
233 474 IF X>13 THEN 488
234 476 PRINT "OF SPADES"
235 478 RETURN
236 480 PRINT "OF CLUBS"
237 482 RETURN
238 484 PRINT "OF HEARTS"
239 486 RETURN
240 488 PRINT "OF DIAMONDS"
241 490 RETURN
242 492 REM DEALER PLAYS
243 494 LET P=2
244 496 PRINT "MY HOLE CARD IS ",
245 498 LET X=M
246 500 GOSUB 434
247 502 IF T2<22 THEN 508
248 504 IF V2=0 THEN 534
249 506 IF T3>21 THEN 534
250 508 LET P=1
251 510 IF T1<17 THEN 548
252 512 IF T1>17 THEN 516
253 514 IF E1>0 THEN 548
254 516 IF T1>21 THEN 554
255 518 LET P=2
256 520 PRINT "MY TOTAL IS ";T1
257 522 IF TP>21 THEN 534
258 524 IF T1>21 THEN 530
259 526 IF T1>TP THEN 534
260 528 IF T1=TP THEN 536
261 530 LET W1=W1+WP
262 532 GOTO 536
263 534 LET W1=W1-WP
264 536 IF V2>0 THEN 542
265 538 GOSUB 566
266 540 GOTO 150
267 542 LET P=3
268 544 LET V2=0
269 546 GOTO 522
270 548 PRINT "I DRAW ",
271 550 GOSUB 366
272 552 GOTO 508
273 554 IF E1= 0 THEN 562
274 556 LET E1 = E1 -1
275 558 LET T1=T1-10
276 560 GOTO 508
277 562 PRINT "I BUSTED***";
278 564 GOTO 518
279 566 IF W1<0 THEN 574
280 568 IF W1=0 THEN 578
281 570 PRINT"YOU'RE AHEAD $";W1
282 572 RETURN
283 574 PRINT "YOU'RE BEHIND $";-W1
284 576 RETURN
285 578 PRINT "YOU'RE EVEN"
286 580 RETURN
287 582 END