mirror of
https://github.com/rfivet/BCG101.git
synced 2024-12-20 17:16:23 -05:00
411 lines
6.6 KiB
QBasic
411 lines
6.6 KiB
QBasic
|
1DIMA(15),B(10)
|
||
|
2DEFFNA(X)=INT(10*RND(X))
|
||
|
3DEFFNB(X)=X-100*INT(X/100)
|
||
|
4PRINT"WELCOME TO THE HALLDEN CASINO. WE EACH HAVE $200"
|
||
|
5PRINT"I WILL OPEN THE BETTING BEFORE THE DRAW; YOU OPEN AFTER"
|
||
|
6PRINT"WHEN YOU FOLD, BET 0; TO CHECK, BET .5"
|
||
|
7PRINT"ENOUGH TALK -- LET'S GET DOWN TO BUSINESS"
|
||
|
8PRINT
|
||
|
9LETO=1
|
||
|
10LETC=200
|
||
|
11LETS=200
|
||
|
12LETP=0
|
||
|
13RANDOM
|
||
|
14PRINT
|
||
|
15IFC<=5THEN367
|
||
|
16PRINT"THE ANTE IS $5. I WILL DEAL"
|
||
|
17PRINT
|
||
|
18IFS>5THEN20
|
||
|
19GOSUB383
|
||
|
20LETP=P+10
|
||
|
21LETS=S-5
|
||
|
22LETC=C-5
|
||
|
23FORZ=1TO10
|
||
|
24GOSUB174
|
||
|
25NEXTZ
|
||
|
26PRINT"YOUR HAND:"
|
||
|
27LETN=1
|
||
|
28GOSUB185
|
||
|
29LETN=6
|
||
|
30LETI=2
|
||
|
31GOSUB217
|
||
|
32PRINT
|
||
|
33IFI<>6THEN47
|
||
|
34IFFNA(0)<=7THEN37
|
||
|
35LETX=11100
|
||
|
36GOTO42
|
||
|
37IFFNA(0)<=7THEN40
|
||
|
38LETX=11110
|
||
|
39GOTO42
|
||
|
40IFFNA(0)>=1THEN45
|
||
|
41LETX=11111
|
||
|
42LETI=7
|
||
|
43LETZ=23
|
||
|
44GOTO58
|
||
|
45LETZ=1
|
||
|
46GOTO51
|
||
|
47IFU>=13THEN54
|
||
|
48IFFNA(0)>=2THEN50
|
||
|
49GOTO42
|
||
|
50LETZ=0
|
||
|
51LETK=0
|
||
|
52PRINT"I CHECK"
|
||
|
53GOTO62
|
||
|
54IFU<=16THEN57
|
||
|
55LETZ=2
|
||
|
56IFFNA(0)>=1THEN58
|
||
|
57LETZ=35
|
||
|
58LETV=Z+FNA(0)
|
||
|
59GOSUB348
|
||
|
60PRINT"I'LL OPEN WITH "V
|
||
|
61LETK=V
|
||
|
62GOSUB305
|
||
|
63GOSUB65
|
||
|
64GOTO82
|
||
|
65IFI<>3THEN76
|
||
|
66PRINT
|
||
|
67PRINT"I WIN"
|
||
|
68LETC=C+P
|
||
|
69PRINT"NOW I HAVE $"C"AND YOU HAVE $"S
|
||
|
70PRINT"DO YOU WISH TO CONTINUE";
|
||
|
71INPUTH$
|
||
|
72IFH$="YES"THEN12
|
||
|
73IFH$="NO"THEN410
|
||
|
74PRINT"ANSWER YES OR NO, IDIOT"
|
||
|
75GOTO70
|
||
|
76IFI<>4THEN81
|
||
|
77PRINT
|
||
|
78PRINT"YOU WIN"
|
||
|
79LETS=S+P
|
||
|
80GOTO69
|
||
|
81RETURN
|
||
|
82PRINT
|
||
|
83PRINT"NOW WE DRAW -- HOW MANY CARDS DO YOU WANT";
|
||
|
84INPUTT
|
||
|
85IFT=0THEN98
|
||
|
86LETZ=10
|
||
|
87IFT<4THEN90
|
||
|
88PRINT"YOU CAN'T DRAW MORE THAN THREE CARDS"
|
||
|
89GOTO84
|
||
|
90PRINT"WHAT ARE THEIR NUMBERS"
|
||
|
91FOR Q=1TOT
|
||
|
92INPUTU
|
||
|
93GOSUB173
|
||
|
94NEXTQ
|
||
|
95PRINT"YOUR NEW HAND:"
|
||
|
96LETN=1
|
||
|
97GOSUB185
|
||
|
98LETZ=10+T
|
||
|
99FORU=6TO10
|
||
|
100IFINT(X/10^(U-6))<>10*INT(X/10^(U-5))THEN102
|
||
|
101GOSUB173
|
||
|
102NEXTU
|
||
|
103PRINT
|
||
|
104PRINT"I AM TAKING"Z-10-T"CARD";
|
||
|
105IFZ=11+TTHEN109
|
||
|
106PRINT"S"
|
||
|
107PRINT
|
||
|
108GOTO110
|
||
|
109PRINT
|
||
|
110LETN=6
|
||
|
111LETV=I
|
||
|
112LETI=1
|
||
|
113GOSUB217
|
||
|
114LETB=U
|
||
|
115LETM=D
|
||
|
116IFV<>7THEN119
|
||
|
117LETZ=28
|
||
|
118GOTO133
|
||
|
119IFI<>6THEN122
|
||
|
120LETZ=1
|
||
|
121GOTO133
|
||
|
122IFU>=13THEN127
|
||
|
123LETZ=2
|
||
|
124IFFNA(0)<>6THEN126
|
||
|
125LETZ=19
|
||
|
126GOTO133
|
||
|
127IFU>=16THEN132
|
||
|
128LETZ=19
|
||
|
129IFFNA(0)<>8THEN131
|
||
|
130LETZ=11
|
||
|
131GOTO133
|
||
|
132LETZ=2
|
||
|
133LETK=0
|
||
|
134GOSUB305
|
||
|
135IFT<>.5THEN145
|
||
|
136IFV=7THEN140
|
||
|
137IFI<>6THEN140
|
||
|
138PRINT"I'LL CHECK"
|
||
|
139GOTO146
|
||
|
140LETV=Z+FNA(0)
|
||
|
141GOSUB348
|
||
|
142PRINT"I'LL BET"V
|
||
|
143LETK=V
|
||
|
144GOSUB306
|
||
|
145GOSUB65
|
||
|
146PRINT
|
||
|
147PRINT"NOW WE COMPARE HANDS"
|
||
|
148LETJ$=H$
|
||
|
149LETK$=I$
|
||
|
150PRINT"MY HAND:"
|
||
|
151LETN=6
|
||
|
152GOSUB185
|
||
|
153LETN=1
|
||
|
154GOSUB217
|
||
|
155PRINT
|
||
|
156PRINT"YOU HAVE ";
|
||
|
157LETK=D
|
||
|
158GOSUB369
|
||
|
159LETH$=J$
|
||
|
160LETI$=K$
|
||
|
161LETK=M
|
||
|
162PRINT"AND I HAVE ";
|
||
|
163GOSUB369
|
||
|
164IFB>UTHEN67
|
||
|
165IFU>BTHEN78
|
||
|
166IFH$="A FLUS"THEN170
|
||
|
167PRINT"THE HAND IS DRAWN"
|
||
|
168PRINT"ALL $"P" REMAIN IN THE POT"
|
||
|
169GOTO14
|
||
|
170IFFNB(M)>FNB(D)THEN67
|
||
|
171IFFNB(D)>FNB(M)THEN78
|
||
|
172GOTO167
|
||
|
173LETZ=Z+1
|
||
|
174LETA(Z)=INT(1000*RND(0))
|
||
|
175IFINT(A(Z)/100)>3THEN174
|
||
|
176IFA(Z)-100*INT(A(Z)/100)>12THEN174
|
||
|
177FORK=1TOZ-1
|
||
|
178IFA(Z)=A(K)THEN174
|
||
|
179NEXTK
|
||
|
180IFZ<=10THEN184
|
||
|
181LETN=A(U)
|
||
|
182LETA(U)=A(Z)
|
||
|
183LETA(Z)=N
|
||
|
184RETURN
|
||
|
185FORZ=NTON+4
|
||
|
186PRINTZ"-- ";
|
||
|
187GOSUB195
|
||
|
188PRINT" OF";
|
||
|
189GOSUB207
|
||
|
190IFZ/2<>INT(Z/2)THEN192
|
||
|
191PRINT
|
||
|
192NEXTZ
|
||
|
193PRINT
|
||
|
194RETURN
|
||
|
195LETK=FNB(A(Z))
|
||
|
196IFK<>9THEN198
|
||
|
197PRINT"JACK";
|
||
|
198IFK<>10THEN200
|
||
|
199PRINT"QUEEN";
|
||
|
200IFK<>11THEN202
|
||
|
201PRINT"KING";
|
||
|
202IFK<>12THEN204
|
||
|
203PRINT"ACE";
|
||
|
204IFK>=9THEN206
|
||
|
205PRINTK+2;
|
||
|
206RETURN
|
||
|
207LETK=INT(A(Z)/100)
|
||
|
208IFK<>0THEN210
|
||
|
209PRINT" CLUBS",
|
||
|
210IFK<>1THEN212
|
||
|
211PRINT" DIAMONDS",
|
||
|
212IFK<>2THEN214
|
||
|
213PRINT" HEARTS",
|
||
|
214IFK<>3THEN216
|
||
|
215PRINT" SPADES",
|
||
|
216RETURN
|
||
|
217LETU=0
|
||
|
218FORZ=NTON+4
|
||
|
219LETB(Z)=FNB(A(Z))
|
||
|
220IFZ=N+4THEN223
|
||
|
221IFINT(A(Z)/100)<>INT(A(Z+1)/100)THEN223
|
||
|
222LETU=U+1
|
||
|
223NEXTZ
|
||
|
224IFU<>4THEN231
|
||
|
225LETX=11111
|
||
|
226LETD=A(N)
|
||
|
227LETH$="A FLUS"
|
||
|
228LETI$="H IN"
|
||
|
229LETU=15
|
||
|
230RETURN
|
||
|
231FORZ=NTON+3
|
||
|
232FORK=Z+1TON+4
|
||
|
233IFB(Z)<=B(K)THEN239
|
||
|
234LETX=A(Z)
|
||
|
235LETA(Z)=A(K)
|
||
|
236LETB(Z)=B(K)
|
||
|
237LETA(K)=X
|
||
|
238LETB(K)=A(K)-100*INT(A(K)/100)
|
||
|
239NEXTK
|
||
|
240NEXTZ
|
||
|
241LETX=0
|
||
|
242FORZ=NTON+3
|
||
|
243IFB(Z)<>B(Z+1)THEN247
|
||
|
244LETX=X+11*10^(Z-N)
|
||
|
245LETD=A(Z)
|
||
|
246GOSUB276
|
||
|
247NEXTZ
|
||
|
248IFX<>0THEN262
|
||
|
249IFB(N)+3<>B(N+3)THEN252
|
||
|
250LETX=1111
|
||
|
251LETU=10
|
||
|
252IFB(N+1)+3<>B(N+4)THEN262
|
||
|
253IFU<>10THEN260
|
||
|
254LETU=14
|
||
|
255LETH$="STRAIG"
|
||
|
256LETI$="HT"
|
||
|
257LETX=11111
|
||
|
258LETD=A(N+4)
|
||
|
259RETURN
|
||
|
260LETU=10
|
||
|
261LETX=11110
|
||
|
262IFU>=10THEN269
|
||
|
263LETD=A(N+4)
|
||
|
264LETH$="SCHMAL"
|
||
|
265LETI$="TZ, "
|
||
|
266LETU=9
|
||
|
267LETX=11000
|
||
|
268GOTO274
|
||
|
269IFU<>10THEN272
|
||
|
270IFI=1THEN274
|
||
|
271GOTO275
|
||
|
272IFU>12THEN275
|
||
|
273IFFNB(D)>6THEN275
|
||
|
274LETI=6
|
||
|
275RETURN
|
||
|
276IFU>=11THEN281
|
||
|
277LETU=11
|
||
|
278LETH$="A PAIR"
|
||
|
279LETI$=" OF "
|
||
|
280RETURN
|
||
|
281IFU<>11THEN291
|
||
|
282IFB(Z)<>B(Z-1)THEN287
|
||
|
283LETH$="THREE"
|
||
|
284LETI$=" "
|
||
|
285LETU=13
|
||
|
286RETURN
|
||
|
287LETH$="TWO P"
|
||
|
288LETI$="AIR, "
|
||
|
289LETU=12
|
||
|
290RETURN
|
||
|
291IFU<>12THEN296
|
||
|
292LETU=16
|
||
|
293LETH$="FULL H"
|
||
|
294LETI$="OUSE, "
|
||
|
295RETURN
|
||
|
296IFB(Z)<>B(Z-1)THEN301
|
||
|
297LETU=17
|
||
|
298LETH$="FOUR"
|
||
|
299LETI$=" "
|
||
|
300RETURN
|
||
|
301LETU=16
|
||
|
302LETH$="FULL H"
|
||
|
303LETI$="OUSE, "
|
||
|
304RETURN
|
||
|
305LETG=0
|
||
|
306PRINT"WHAT IS YOUR BET";
|
||
|
307INPUTT
|
||
|
308IFT-INT(T)=0THEN314
|
||
|
309IFK<>0THEN312
|
||
|
310IFG<>0THEN312
|
||
|
311IFT=.5THEN341
|
||
|
312PRINT"NO SMALL CHANGE, PLEASE"
|
||
|
313GOTO306
|
||
|
314IFS-G-T>=0THEN317
|
||
|
315GOSUB383
|
||
|
316GOTO306
|
||
|
317IFT<>0THEN320
|
||
|
318LETI=3
|
||
|
319GOTO338
|
||
|
320IFG+T>=KTHEN323
|
||
|
321PRINT"IF YOU CAN'T SEE MY BET, THEN FOLD"
|
||
|
322GOTO306
|
||
|
323LETG=G+T
|
||
|
324IFG=KTHEN338
|
||
|
325IFZ<>1THEN342
|
||
|
326IFG>5THEN330
|
||
|
327IFZ>=2THEN335
|
||
|
328LETV=5
|
||
|
329GOTO342
|
||
|
330IFZ=1THEN332
|
||
|
331IFT<=25THEN335
|
||
|
332LETI=4
|
||
|
333PRINT"I FOLD"
|
||
|
334RETURN
|
||
|
335IFZ=2THEN343
|
||
|
336PRINT"I'LL SEE YOU"
|
||
|
337LETK=G
|
||
|
338LETS=S-G
|
||
|
339LETC=C-K
|
||
|
340LETP=P+G+K
|
||
|
341RETURN
|
||
|
342IFG>3*ZTHEN335
|
||
|
343LETV=G-K+FNA(0)
|
||
|
344GOSUB348
|
||
|
345PRINT"I'LL SEE YOU, AND RAISE YOU"V
|
||
|
346LETK=G+V
|
||
|
347GOTO306
|
||
|
348IFC-G-V>=0THEN366
|
||
|
349IFG<>0THEN352
|
||
|
350LETV=C
|
||
|
351RETURN
|
||
|
352IFC-G>=0THEN336
|
||
|
353IFO/2<>INT(O/2)THEN360
|
||
|
354PRINT"WOULD YOU LIKE TO BUY BACK YOUR WATCH FOR $50";
|
||
|
355INPUTJ$
|
||
|
356IFJ$="NO"THEN360
|
||
|
357LETC=C+50
|
||
|
358LETO=O/2
|
||
|
359RETURN
|
||
|
360IFO/3<>INT(O/3)THEN367
|
||
|
361PRINT"WOULD YOU LIKE TO BUY BACK YOUR TIE TACK FOR $50";
|
||
|
362INPUTJ$
|
||
|
363IFJ$="NO"THEN367
|
||
|
364LETC=C+50
|
||
|
365LETO=O/3
|
||
|
366RETURN
|
||
|
367PRINT"I'M BUSTED. CONGRATULATIONS"
|
||
|
368STOP
|
||
|
369PRINTH$;I$;
|
||
|
370IFH$<>"A FLUS"THEN375
|
||
|
371LETK=INT(K/100)
|
||
|
372GOSUB208
|
||
|
373PRINT
|
||
|
374RETURN
|
||
|
375LETK=FNB(K)
|
||
|
376GOSUB196
|
||
|
377IFH$="SCHMAL"THEN379
|
||
|
378IFH$<>"STRAIG"THEN381
|
||
|
379PRINT" HIGH"
|
||
|
380RETURN
|
||
|
381PRINT"S"
|
||
|
382RETURN
|
||
|
383PRINT
|
||
|
384PRINT"YOU CAN'T BET WHAT YOU HAVEN'T GOT"
|
||
|
385IFO/2=INT(O/2)THEN397
|
||
|
386PRINT"WOULD YOU LIKE TO SELL YOUR WATCH";
|
||
|
387INPUTJ$
|
||
|
388IFJ$="NO"THEN397
|
||
|
389IFFNA(0)>=7THEN393
|
||
|
390PRINT"I'LL GIVE YOU $75 FOR IT"
|
||
|
391LETS=S+75
|
||
|
392GOTO395
|
||
|
393PRINT"THAT'S A PRETTY CRUMMY WATCH - I'LL GIVE YOU $25"
|
||
|
394LETS=S+25
|
||
|
395LETO=O*2
|
||
|
396RETURN
|
||
|
397IFO/3=INT(O/3)THEN409
|
||
|
398PRINT"WILL YOU PART WITH THAT DIAMOND TIE TACK";
|
||
|
399INPUTJ$
|
||
|
400IFJ$="NO"THEN408
|
||
|
401IFFNA(0)>=6THEN405
|
||
|
402PRINT"YOU ARE NOW $100 RICHER"
|
||
|
403LETS=S+100
|
||
|
404GOTO407
|
||
|
405PRINT"IT'S PASTE. $25"
|
||
|
406LETS=S+25
|
||
|
407LETO=O*3
|
||
|
408RETURN
|
||
|
409PRINT"YOUR WAD IS SHOT. SO LONG, SUCKER"
|
||
|
410END
|