home *** CD-ROM | disk | FTP | other *** search
- 2 printchr$(147)"would you like instructions (y/n)?
- 4 [161] a$: [139] a$[179][177] "y" [175] a$[179][177]"n" [167] 4
- 6 [139] a$[178]"n" [167] 84
- 8 [153]"instructions on screen or printer (s/p)?
- 10 get b$: if b$<> "s" and b$<>"p" then 10
- 12 if b$="s"then d=3
- 14 if b$="p" then d=4
- 16 open d,d
- 18 print#d,"
- 20 [152]d,"cards-31 by john fedor
- 22 print#d,"
- 24 [152]d,"run it right: c-64
- 26 print#d,"
- 28 [152]d,"cards-31 is an adaptation of knock, a
- 30 print#d,"game where you can win nickels by
- 32 [152]d,"scoring close to 31 with cards of one
- 34 print#d,"suit. here the pot holds $5 bills. you
- 36 [152]d,"and up to 4 computer opponents each
- 38 print#d,"start with three cards and $15. number
- 40 [152]d,"cards are worth face-value, face cards
- 42 print#d,"are worth 10 and aces 11.
- 44 [152]d,"
- 46 print#d,"you have four options: draw a card from
- 48 [152]d,"the deck; draw the top card from the
- 50 print#d,"discard pile. if you think you're
- 52 [152]d,"closer to 31 than your opponents, ask
- 54 print#d,"the computer for advice or knock. when
- 56 [152]d,"you draw, you must also discard.":[139] d[178]4 [167] 64
- 58 [152]d,"
- 60 print"press a key to continue"
- 62 get dd$:if dd$="" then 62
- 64 print#d,"
- 66 [152]d,"
- 68 print#d,"
- 70 [152]d,"after you knock, each player gets one
- 72 print#d,"more turn, then scores are computed.
- 74 [152]d,"your score is the highest total in one
- 76 print#d,"suit. losers give $5 to the pot, and
- 78 [152]d,"a game continues until only one player
- 80 print#d,"has money left and wins the pot.
- 82 [152]d,"":[160]d
- 84 [153]"press any key to begin the program..."
- 86 [161] e$:[139] e$[178]"" [167] 86
- 88 [156]
- 90 [143] cards 31 - john fedor
- 92 [156]:[134] p$(5),d(52),h(5,4),q(3),c$(13),s$(4),ca(5),mo(5),sc(4),t(4),te(5)
- 94 [151]53280,11:[151]53281,12
- 96 [153]"loadcards-31"
- 98 [153]"programmed by john fedor"
- 100 [153]"how many opponents would you like (1-4)?"
- 102 [153]"(press <d> if you would like to watch.)"
- 104 [151]198,0:pl$[178]"d":p$(1)[178]"observer"
- 106 [161]a$:[139](a$[179]"1"[176]a$[177]"4")[175]a$[179][177]"d"[167]106
- 108 [139]a$[178]"d"[167]op[178]5:mo(1)[178]0:[137]120
- 110 [153]"loadyou will play against "a$" opponent";:op[178][197](a$)[170]1:pl$[178]""
- 112 a$[178]"s.":[139]op[178]2[167]a$[178]"."
- 114 [153]a$
- 116 [153]"what shall i call you ";
- 118 [133]p$(1):p$(1)[178][200](p$(1),12):[129]i[178]1[164]5:mo(i)[178]0:[130]i:mo(1)[178]15:ca(1)[178]27
- 120 [129]i[178]2[164] op:mo(i)[178]15
- 122 [135]p$(i),ca(i):[139]p$(i)[178]p$(1)[167]122
- 124 [130]i:tu[178]0
- 126 [131] fred,30,ted,29,alfred,28,ernest,27,bertram,25
- 128 [143] start again here
- 130 [153]"loadthe players are:":kn[178]0
- 132 [129]i[178]1[164]op:[153]p$(i)[163]15)"$"mo(i):[130]
- 134 [153]"pot:"[163]15)"$";
- 136 m[178]op[172]15:[129]i[178]1[164]op:m[178]m[171]mo(i):[130]i:[139]p$(1)[178]"observer"[167]m[178]m[171]15
- 138 [153]m
- 140 [153]"shuffling deck.........................";
- 142 [129]y[178]0[164]3:[129]x[178]1[164]13:d(y[172]13[170]x)[178]y[172]100[170]x:[130]x:[153]"cmd cmd";:[130]y
- 144 [129]x[178]1[164]21:[129]y[178]1[164]7
- 146 z1[178][181]([187](1)[172]52)[170]1:z2[178][181]([187](1)[172]52)[170]1
- 148 z3[178]d(z1):d(z1)[178]d(z2):d(z2)[178]z3
- 150 [130]y:[153]"cmd cmd";:[130]x:[153]
- 152 [153]"dealing..."
- 154 dp[178]1:[143] deck pointer
- 156 [129]i[178]1[164] 3
- 158 [129]z[178]1[164] op
- 160 [139] mo(z)[178]0[167]164
- 162 h(z,i)[178]d(dp):dp[178]dp[170]1
- 164 [130]z,i
- 166 di[178]d(dp):dp[178]dp[170]1:[143] discard pile
- 168 [129]i[178]1[164]3:q(i)[178]h(1,i):[130]:[143] for print routine
- 170 tu[178]tu[170]1:[139]tu[177]op[167]tu[178]1
- 172 [139] dp[177]52[167][153]"loadno more cards in the deck.":[137]288
- 174 [139] kn[179][177]0 [167] kn[178]kn[171]1:[139] kn[178]0 [167][153]"loadlast round completed.":[137]288
- 176 [139] mo(tu)[178]0[167]168
- 178 [153]"loadyour hand:"
- 180 [139] mo(1)[178]0 [167][153]""[163]13)"not availableonononon":[137]184
- 182 [141] 350
- 184 [153]"":[153]"discard pile:":q(1)[178]di:q(2)[178]0:q(3)[178]0:[141]350
- 186 [139]tu[177]1[167]256
- 188 [153]"what would you like to do?"
- 190 [153]"1) pick from deck"
- 192 [153]"2) pick from discard pile"
- 194 [153]"3) knock"
- 196 [153]"4) ask for advice";:[151]198,0
- 198 [161]a$:[139]a$[179]"1"[176]a$[177]"4"[167]198
- 200 [139]a$[178]"3"[175]kn[179][177]0[167]198
- 202 [139]a$[178]"3"[167] kn[178]op:[153]"knocking...";:[129]i[178]1[164]5000:[130]:[137]168
- 204 [139]a$[178]"4"[167]226
- 206 [139]a$[178]"1"[167]di[178]d(dp):dp[178]dp[170]1
- 208 [153]"load"[163]8)"(1)"[163]18)"(2)"[163]28)"(3)"
- 210 [129]i[178]1[164]3:q(i)[178]h(1,i):[130]:[141]350
- 212 [153]""[163]18)"(4)"
- 214 q(1)[178]0:q(2)[178]di:q(3)[178]0:[141]350
- 216 [153]"which one would you like to discard?"
- 218 [151]198,0
- 220 [161]a$:[139]a$[179]"1"[176]a$[177]"4"[167]220
- 222 [139]a$[179][177]"4"[167]a[178]di:di[178]h(1,[197](a$)):h(1,[197](a$))[178]a
- 224 [137]168
- 226 [143] give advice
- 228 k1[178]31[171]op[172]2[171]2[172](i[178]4)[171]4[172](i[178]5)
- 230 [143] check to see for discard
- 232 h(1,4)[178]di
- 234 [129]i[178]1[164]4:sc(i)[178]h(1,i):[130]
- 236 [141]386
- 238 [139]dr[178]4[167]242
- 240 [153]"loadif i were you, i would pick up from the discard pile.":[137]248
- 242 [139] kn[179][177]0[167]246
- 244 [139]sc[177][178]k1[167][153]"loadit would seem logical to knock at this time.":[137]248
- 246 [153]"loadyou might as well take a chance and picka card from the deck."
- 248 [153]"press <return> to continue."
- 250 [151]198,0
- 252 [161]a$:[139]a$[179][177][199](13)[167]252
- 254 tu[178]tu[171]1:[137]168
- 256 [143] computer's turn
- 258 k1[178]ca(tu)
- 260 h(tu,4)[178]di
- 262 [129]i[178]1[164]4:sc(i)[178]h(tu,i):[130]
- 264 [141]386:[153]"";
- 266 [139]dr[178]4 [167] 274
- 268 [139]di[171][181](di[173]100)[172]100[179]2 [175] kn[178]0 [167]280
- 270 a$[178]p$(tu)[170]" is picking from the discard pile.":[141]420
- 272 di[178]h(tu,dr):h(tu,dr)[178]h(tu,4):[129]i[178]1[164]1000:[130]i:[137]168
- 274 [139] sc[179]k1 [176] kn[179][177]0 [167] 280
- 276 a$[178]p$(tu)[170]" is knocking.":[141]420
- 278 kn[178]op:[129]i[178]1[164]1000:[130]i:[137]168
- 280 a$[178]p$(tu)[170]" picks a card from the deck.":[141]420
- 282 h(tu,4)[178]d(dp):dp[178]dp[170]1
- 284 [129]i[178]1[164]4:sc(i)[178]h(tu,i):[130]
- 286 [141]386:di[178]h(tu,dr):h(tu,dr)[178]h(tu,4):[129]i[178]1[164]1000:[130]i:[137]168
- 288 [143] round over
- 290 [153]"":[129]i4[178]1[164]op:[141]432:[130]i4
- 292 x[178]0:sc[178]0:[129]i[178]1[164]op:[139]te(i)[177]sc[167]sc[178]te(i)
- 294 [130]i
- 296 [129]i[178]1[164]op:[139]te(i)[178]sc[167]x[178]x[170]1
- 298 [130]i:a$[178]" is":[139]x[177]1[167]a$[178]"s are"
- 300 [153]"the winner"a$": ";
- 302 [129]i[178]1[164]op:[139]te(i)[178]sc[167][153]p$(i)",";
- 304 [139] te(i)[179]sc[167]mo(i)[178]mo(i)[171]5:[139]mo(i)[179]0[167]mo(i)[178]0
- 306 [130]i:[153]"cmd."
- 308 [153]"press <return> to continue."
- 310 [151]198,0
- 312 [161]a$:[139]a$[179][177][199](13)[167]312
- 314 x[178]0:[129]i[178]1[164]op:[139]mo(i)[179][177]0[167]x[178]x[170]1
- 316 [130]i:[139]x[177]1[167]328
- 318 [153]"loadthe winner is: ";
- 320 [129]i[178]1[164]op:[139]mo(i)[179][177]0[167][153]p$(i)
- 322 [130]i:[153]"the winning pot is $";:m[178]op[172]15:[129]i[178]1[164]op:m[178]m[171]mo(i):[130]
- 324 [139]p$(1)[178]"observer"[167]m[178]m[171]15
- 326 [153]m:[137]342
- 328 [139] mo(1)[179][177]0 [167] 130
- 330 [139]pl$[178]"d"[167]130
- 332 [153]"loadyou are out of the game."
- 334 [153]"would you like to watch the others play?"
- 336 [151]198,0
- 338 [161]a$:[139]a$[179][177]"y"[175]a$[179][177]"n"[167]338
- 340 [139]a$[178]"y"[167]pl$[178]"d":[137]130
- 342 [153]"press <return> to restart."
- 344 [151]198,0
- 346 [161]a$:[139]a$[179][177][199](13)[167]346
- 348 [138]
- 350 [143] print out card(s)
- 352 [129]i[178]1[164]3:a[178]q(i):s[178][181](a[173]100):f[178]a[171]s[172]100:s[178]s[170]1
- 354 [139]q(i)[178]0[167]382
- 356 s$(1)[178]"atn":s$(2)[178]"(NULL)":s$(3)[178]"(NULL)":s$(4)[178]"(NULL)"
- 358 c$(1)[178]"2":c$(2)[178]"3":c$(3)[178]"4":c$(4)[178]"5":c$(5)[178]"6":c$(6)[178]"7":c$(7)[178]"8"
- 360 c$(8)[178]"9":c$(9)[178]"10":c$(10)[178]"j":c$(11)[178]"q":c$(12)[178]"k":c$(13)[178]"a"
- 362 s$[178]s$(s):c$[178]c$(f)
- 364 [139][195](c$)[179]2[167]c$[178]" "[170]c$
- 366 [153][163](i[171]1)[172]10[170]5)"step (NULL)wait"
- 368 [153][163](i[171]1)[172]10[170]5)" "c$" wait"
- 370 [153][163](i[171]1)[172]10[170]5)" wait"
- 372 [153][163](i[171]1)[172]10[170]5)" "s$" wait"
- 374 [153][163](i[171]1)[172]10[170]5)" wait"
- 376 [153][163](i[171]1)[172]10[170]5)" "c$" wait"
- 378 [153][163](i[171]1)[172]10[170]5)"(NULL) waitstep"
- 380 [153]"onononononononon"
- 382 [130]i
- 384 [142]
- 386 [143] score the hand (sc(1)-sc(4))
- 388 [143] return sc=best score
- 390 [143] dr=worst card
- 392 [129]i[178]1[164]4:[139]sc(i)[178]0[167]sc(i)[178]500
- 394 [130]i
- 396 dr[178]1:sc[178]0:[129]i[178]1[164]4:[143] i is the card not to be included during search
- 398 [129]x[178]1[164]4:t(x)[178]0:[130]x
- 400 [129]x[178]1[164]4:[139]x[178]i[167]408
- 402 a[178]sc(x):b[178][181](a[173]100):c[178]1[170]a[171]b[172]100:b[178]b[170]1:[139]c[177]10[167]c[178]10[171](c[178]14)
- 404 [139]b[177]4[167]408
- 406 t(b)[178]t(b)[170]c
- 408 [130]x:q[178]0:[129]x[178]1[164]4:[139]t(x)[177]q[167]q[178]t(x)
- 410 [130]x:[139]q[177]sc[167]sc[178]q:dr[178]i:[137]418
- 412 [139]q[179]sc[167]418
- 414 [139]i[178]4[167]dr[178]i:[137]418
- 416 [139]sc(dr)[171][181](sc(dr)[173]100)[172]100[177]sc(i)[171][181](sc(i)[173]100)[172]100[167]dr[178]i
- 418 [130]i:[142]
- 420 [143] print out a$-> no wrap around
- 422 x[178]0:[153]"";
- 424 [129]i[178]1[164][195](a$):[139][202](a$,i,1)[179][177]" "[167][130]i:i[178][195](a$)
- 426 [139]x[170]i[177]38[167][153]:[153]"";:x[178]0
- 428 x[178]x[170]i:[153][200](a$,i);:a$[178][201](a$,[195](a$)[171]i):[139]a$[179][177]""[167]424
- 430 [153]:[142]
- 432 [143] print out name,cards,score
- 434 [153]p$(i4);:[139]i4[178]tu[167][153]" (knocked)";
- 436 [153][163]23):[139] mo(i4)[178]0[167][153]"out of play"[163]36):sc[178]0:[137]444
- 438 [129]x[178]1[164]3:a[178]h(i4,x):s[178][181](a[173]100):f[178]a[171]s[172]100:s[178]s[170]1
- 440 [153]c$(f)s$(s)" ";:[130]x:[153][163]36)
- 442 [129]i[178]1[164]3:sc(i)[178]h(i4,i):[130]i:sc(4)[178]0:[141]386
- 444 [153]sc" ":te(i4)[178]sc:[142]
-