home *** CD-ROM | disk | FTP | other *** search
- 1 goto910
- 5 rem ** blackjack from the public domain with chages made for the c64 by
- 6 rem ** ken jirele and fred layberger, omaha nebraska
- 10 rem **general input routine **
- 15 :
- 30 :
- 35 rem +++ input section +++
- 40 pokeuo,0:ur$="":ui$=""
- 42 iful=0thenul=80
- 45 pokeuc,0
- 50 getui$:ifui$=""then50
- 55 ifui$=chr$(13)andlen(ur$)>=1thenpokeuc,1:print" [157]";:goto120
- 60 ifui$=chr$(20)then105
- 62 if len(ur$)=>ulthen50
- 65 gosub120:rem check for valid character
- 70 ur$=ur$+ui$
- 75 printui$;
- 80 goto50
- 102 rem ++ check delete ++
- 105 iflen(ur$)<1then50
- 110 ur$=left$(ur$,len(ur$)-1)
- 115 print"[157] [157][157]";:goto50
- 120 rem ++ check for valid characters ++
- 125 iflen(us$)=0then150
- 130 forus=1tolen(us$)
- 135 ifui$=mid$(us$,us,1)thenreturn
- 140 next
- 145 ui$="":return
- 150 rem ** standard input **
- 152 ifasc(ui$)=46thenreturn
- 155 ifui$=chr$(32)thenreturn
- 160 ifasc(ui$)<48orasc(ui$)>57then170
- 165 return
- 170 ifasc(ui$)<65orasc(ui$)>90then180
- 175 return
- 180 ifasc(ui$)<193orasc(ui$)>218thenui$="":return
- 185 ifpeek(ut)=ul%thenui$=chr$(asc(ui$)-128):return
- 187 return
- 190 ui$="":return
- 216 goto300
- 217 uz=0:us$=uj$:ug$=uk$:up=uj:ul=uk:ifpeek(50003)=0thenpoke53281,6:poke53280,14
- 220 print"[147]";:pokeut,uv%:foruq=ubto(u2%*256+u1%+u3%-3)
- 225 pokeuq,uq%(uq-ub):next
- 230 pokeu1,u1%
- 232 pokeu2,u2%
- 233 pokeu4,u4%
- 234 pokeu3,u3%-1
- 235 goto35
- 300 rem ** menu **
- 301 :
- 302 print"[147][144]":pokeut,uu%:ifpeek(50003)=0thenpoke53281,15:poke53280,0
- 303 :
- 305 print" menu"
- 310 print" --------------------------------------"
- 315 print" 1. begin blackjack"
- 320 print" 2. instructions"
- 335 print" 3. quit"
- 340 print" --------------------------------------"
- 345 print" press a number key (1-3) ";
- 350 ul=1:us$="123":gosub35:rem input routine
- 352 us$=""
- 355 onval(ur$)gosub1000,400,396
- 360 goto300
- 395 rem ** re-enable stop key and end **
- 396 clr:end
- 400 rem ** student instructions **
- 405 print"[147]":pokeut,ul%:ifpeek(50003)=0thenpoke53281,15:poke53280,0
- 410 up=0:ug$="[211]tudent [201]nst":gosub850
- 413 print" [212]his game simulates the game of
- 415 [153]" blackjack.":[153]" (NULL)ou must get up to 21 in less"
- 420 [153]" than 5 cards. (NULL)ou can bet on"
- 422 [153]" your hand. right$f you lose, your bet"
- 425 [153]" is deducted from your total":[153]" earnings."
- 426 [141]835:[141]850
- 427 [153]" (NULL)ou may decide if you want"
- 430 [153]" another card each time. right$f you"
- 431 [153]" want to double your bet when you"
- 433 [153]" are in the middle of a hand, the"
- 435 [153]" computer will give you another "
- 436 [153]" card and double your bet."
- 437 [141]835:[141]850
- 438 [153]" (NULL)o double betwait: type d <return>"
- 440 [153]" left$ouse limit on each betwait:":[153][163]26)"$25,000.00"
- 485 [141]835
- 490 [139]uz[178]1[167][158]up%:[137]217
- 499 [142]
- 835 [143] ** space bar press **
- 840 [151]uo,0:[153][200](ud$,24);"press space bar to continuewait"
- 844 [161]ui$:[139]ui$[179][177]" "[167]844
- 846 [142]
- 850 [143] ** page design routine **
- 852 up[178]up[170]1
- 853 [139][194](ut)[178]ul%[167]855
- 854 ut$[178]" blackjack":ug$[178]"blackjack":[137]857
- 855 ut$[178]" peek(NULL)atnlen(NULL)mid$atnlen(NULL)"
- 857 [153]"load"[200](ut$[170]up$,21);[201](up$[170]ug$[170][196](up),18)
- 860 [153]" --------------------------------------"
- 864 [139]uh[179][177]0[167]870
- 865 [153][200](ud$,24);[200](up$,6);"to exit game press qwait ."
- 870 uh[178]0:[153]"":[142]
- 875 [143] ** please wait remark **
- 880 [153][200](ud$,24);" one moment please... "
- 885 [142]
- 900 [143] ** set up variables **
- 901 ux$[178]"h":[134]uq%(1000):ub[178]32768:u1[178]196:u2[178]197:u3[178]198:u4[178]216:uc[178]167:uu[178]1024
- 902 ut[178]59468:uu%[178]12:ul%[178]14:up%[178]1146:um[178]32768:uo[178]158:[151] 50003,0
- 903 [139][194](50003)[178]0[167]ub[178]1024:u1[178]209:u2[178]210:u3[178]211:u4[178]214:uc[178]204:uu[178]2048
- 904 [139][194](50003)[178]0[167]ut[178]53272:uu%[178]21:ul%[178]23:up%[178]2139:um[178]1024:uo[178]198
- 905 ud$[178]""
- 906 up$[178]" "
- 908 [142]
- 910 [143] ** set variables **
- 911 [134]c(52),p(10),d(10)
- 912 [134]s$(52),c$(52)
- 920 [141]900
- 980 [137]300:[143] menu
- 1000 [139]uz[178]1[167][158]up%:[158]up%:uz[178]0:[143] ** program starts here **
- 1001 [153]"load";:[140]:[139][194](50003)[178]0[167][151]53281,15:[151]53280,5
- 1070 s9$[178]"atn(NULL)(NULL)(NULL)"
- 1080 c8$[178]"23456789tjqka"
- 1090 c9$[178]" 2 3 4 5 6 7 8 91010101011"
- 1100 er$[178]"":[129]i[178]1[164]13:er$[178]er$[170]" ":[130]
- 1110 [129]i[178]1[164]13:er$[178]er$[170]"cmdcmdcmd":[130]
- 1115 er$[178]er$[170]" "
- 1120 dn$[178]""
- 1130 [143]
- 1170 [141]2260
- 1180 t[178]0
- 1190 j8[178]j
- 1200 [139]a9[179]4[167]1220
- 1210 [141]835:[141]2260
- 1220 [139]j[179]42[167]1240
- 1230 [141]835:[141]2260
- 1240 [153]dn$;er$"place your bet. cmdcmdcmdcmdcmd";
- 1250 us$[178]"012345678910q":ul[178]5:[141]35:[139]ur$[178]"q"[167]2160
- 1260 b1[178][197](ur$):k$[178]b$
- 1270 [139]b1[178]0[167]1240
- 1280 [139]b1[177]0[167]1310
- 1290 [141]835:[141]2260
- 1300 b1[178][171]b1
- 1310 [139]b1[177][178]1[167]1340
- 1320 [153]er$"the minimum bet is $1"
- 1330 [137]1190
- 1340 [139]b1[179][178]25000[167]1380
- 1350 [139]m1[178]1[167]2950
- 1360 [153]er$:[153]er$:[153]er$"the limit per bet is $25,000."
- 1370 [137]1240
- 1380 p[178]0:d[178]0:p9[178]0:d9[178]0
- 1390 v[178]0
- 1400 h[178]0
- 1410 [141]850
- 1420 m1[178]1
- 1430 [141]2530
- 1440 [141]2650
- 1450 [141]3700
- 1460 j1[178]j
- 1470 m1[178]2
- 1480 [141]2530
- 1490 [141]2650
- 1500 [141]2860
- 1510 [139]p[178]21[167]1570
- 1520 [139]d[179]21[167]1650
- 1530 m1[178]1
- 1540 [141]2860
- 1550 [153]dn$""er$"dealer has a blackjack"
- 1560 [137]2060
- 1570 m1[178]1
- 1580 [141]2860
- 1590 [139]d[179]21[167]1620
- 1600 [153]dn$""er$"we both have blackjack"
- 1610 [137]2000
- 1620 [153]dn$""er$"you have a blackjack"
- 1630 b1[178]1.5[172]b1
- 1640 [137]2020
- 1650 [139]p[179]22[167]1710
- 1660 [153]dn$""er$"you have busted"
- 1665 [129]q[178]1[164]400:[130]q
- 1670 m1[178]1
- 1680 [141]2860
- 1690 m1[178]2
- 1700 [137]2060
- 1710 [139]v[178]0[167]1730
- 1720 [137]1870
- 1730 [153]dn$;er$"do want another card? ";
- 1760 us$[178]"yndq":ul[178]1:[141]35:a$[178]ur$
- 1765 [139]a$[178]"q"[167]2160
- 1770 [139]a$[178]"y"[167]1830
- 1780 [139]a$[178]"d"[167]1810
- 1800 [137]1870
- 1810 b1[178]2[172]b1
- 1820 v[178]1
- 1830 k$[178]b$
- 1840 m1[178]m1[170]1
- 1850 [141]2530
- 1860 [137]1650
- 1870 m1[178]1
- 1880 [141]2860
- 1890 m1[178]2
- 1900 [139]d[177]16[167]1950
- 1910 m1[178]m1[170]1
- 1920 [141]2650
- 1930 [141]2860
- 1940 [137]1900
- 1950 [139]d[179][178]21[167]1980
- 1960 [153]dn$""er$"dealer has broke--you win!":[141]3950
- 1970 [137]2030
- 1980 [139]d[179]p[167]2020
- 1990 [139]d[177]p[167]2060
- 2000 [153]dn$""er$"you pushed the dealer"
- 2010 [137]2080
- 2020 [153]dn$""er$"you win!":[141]3950
- 2030 t[178]t[170]b1
- 2040 [137]2080
- 2060 [153]dn$""er$"you loose!":[141]3900
- 2070 t[178]t[171]b1
- 2080 [139]t[177]0[167]2120
- 2090 [139]t[179]0[167]2140
- 2100 [153]" you are even "
- 2110 [137]1190
- 2120 [153]" you are ahead $";t;
- 2130 [137]1190
- 2140 [153]" you are down $";[171]t;
- 2150 [137]1190
- 2160 [141]850
- 2170 [139]t[178]0[167]2210
- 2180 [139]t[179]0[167]2230
- 2190 [153]dn$" you have won $";t;"cmd."
- 2200 [137]2250
- 2210 [153]dn$" you broke even."
- 2220 [137]2250
- 2230 [153]dn$" you lost $";[171]t;"cmd."
- 2250 [141]835:[142]
- 2260 [143] *** shuffling routine
- 2270 [153]"load"dn$;er$" i'm shuffling the cards."
- 2280 [129]i[178]1[164]4
- 2290 [129]j[178]1[164]13
- 2300 w1[178]13[172](i[171]1)[170]j
- 2305 [153][163]18)"on cmdcmdcmd";65[171]i[172]13[171]j
- 2310 s$(w1)[178][202](s9$,i,1)
- 2320 c$(w1)[178][202](c8$,j,1)
- 2330 c(w1)[178][197]([202](c9$,2[172]j[171]1,2))
- 2340 [130]j
- 2350 [130]i
- 2360 [129]i[178]1[164]52
- 2365 [153][163]18)"on cmdcmdcmd";i;" "
- 2370 j[178]52[172][187](1)[170]1
- 2380 tt$[178]s$(i)
- 2390 s$(i)[178]s$(j)
- 2400 s$(j)[178]tt$
- 2410 tt$[178]c$(i)
- 2420 c$(i)[178]c$(j)
- 2430 c$(j)[178]tt$
- 2440 tt[178]c(i)
- 2450 c(i)[178]c(j)
- 2460 c(j)[178]tt
- 2470 [130]i
- 2480 a9[178]0
- 2490 j[178]0
- 2500 j1[178]2
- 2510 j8[178]0
- 2514 [141]850
- 2520 [142]
- 2530 j[178]j[170]1
- 2540 p(m1)[178]j
- 2550 [139]c(j)[179]11[167]2580
- 2560 p9[178]p9[170]1
- 2570 a9[178]a9[170]1
- 2580 p[178]p[170]c(j)
- 2590 [139]p[179]22[167]2630
- 2600 [139]p9[178]0[167]2630
- 2610 p[178]p[171]10
- 2620 p9[178]p9[171]1
- 2630 [153]dn$""
- 2640 [137]2890
- 2650 j[178]j[170]1
- 2660 d(m1)[178]j
- 2670 [139]c(j)[179]11[167]2700
- 2680 d9[178]d9[170]1
- 2690 a9[178]a9[170]1
- 2700 d[178]d[170]c(j)
- 2710 [139]d[179]22[167]2750
- 2720 [139]d9[178]0[167]2750
- 2730 d[178]d[171]10
- 2740 d9[178]d9[171]1
- 2750 [142]
- 2760 [129]i[178]1[164]52
- 2770 p(i)[178]0
- 2780 d(i)[178]0
- 2790 [130]i
- 2800 [142]
- 2810 [129]i[178]1[164]52
- 2820 [153]c$(i)[170]s$(i);
- 2830 [130]i
- 2840 [153]
- 2850 [142]
- 2860 p5[178]0
- 2870 [153]""
- 2880 [137]2900
- 2890 p5[178]1
- 2900 [129]l[178]1[164]8
- 2910 [139]m1[178]1[167]2950
- 2920 [129]i5[178]1[164]m1[171]1
- 2930 [153]"";
- 2940 [130]i5
- 2950 [139]p5[178]1[167]2980
- 2960 i[178]d(m1)
- 2970 [137]2990
- 2980 i[178]p(m1)
- 2990 [151]646,2
- 2995 [139]s$(i)[178]"atn"[176]s$(i)[178]"(NULL)"[167][151]646,0:[141]3800
- 2996 [139]s$(i)[178]"(NULL)"[176]s$(i)[178]"(NULL)"[167][151]646,2:[141]3850
- 3000 r[178]c(i)
- 3010 [139]l[177]1[167]3030
- 3020 [153]qq$;:[137]3660
- 3030 [139]l[177]2[167]3100
- 3040 [143]
- 3050 [139]c$(i)[178]"t"[167]3080
- 3060 [153]rr$;[201](c$(i),1);" ";rr$;
- 3070 [137]3660
- 3080 [153]rr$;"10";" ";rr$;
- 3090 [137]3660
- 3100 [139]l[177]3[167]3170
- 3110 [139]c(i)[179]11[167]3130
- 3120 [137]3590
- 3130 [139]c(i)[177]2[167]3150
- 3140 [137]3590
- 3150 [139]c(i)[177]3[167]3630
- 3160 [137]3610
- 3170 [139]l[177]4[167]3320
- 3180 [139]c(i)[179]11[167]3200
- 3190 [137]3610
- 3200 [139]c(i)[179]9[167]3220
- 3210 [137]3650
- 3220 [139]c(i)[177]3[167]3240
- 3230 [137]3610
- 3240 [139]c(i)[177]4[167]3260
- 3250 [137]3590
- 3260 [139]c(i)[177]5[167]3280
- 3270 [137]3610
- 3280 [139]c(i)[177]6[167]3300
- 3290 [137]3630
- 3300 [139]c(i)[177]7[167]3630
- 3310 [137]3610
- 3320 [139]l[177]5[167]3420
- 3330 [139]c(i)[179]11[167]3350
- 3340 [137]3590
- 3350 [139]c(i)[179]10[167]3370
- 3360 [137]3650
- 3370 [139]c(i)[179]6[167]3390
- 3380 [137]3630
- 3390 [139]c(i)[179]4[167]3410
- 3400 [137]3590
- 3410 [137]3610
- 3420 [139]l[177]6[167]3510
- 3430 [139]c(i)[179]11[167]3450
- 3440 [137]3590
- 3450 [139]c(i)[179]7[167]3470
- 3460 [137]3630
- 3470 [139]c(i)[178]4[167]3500
- 3480 [139]c(i)[178]5[167]3500
- 3490 [137]3590
- 3500 [137]3630
- 3510 [139]l[177]7[167]3580
- 3520 [153]rr$" ";
- 3530 [139]c$(i)[178]"t"[167]3560
- 3540 [153]" "[201](c$(i),1);rr$;
- 3550 [137]3660
- 3560 [153]" 10";rr$;
- 3570 [137]3660
- 3580 [153]ss$;:[137]3660
- 3590 [153]rr$" "rr$;
- 3600 [137]3660
- 3610 [153]rr$" ";s$(i);" ";rr$;
- 3620 [137]3660
- 3630 [153]rr$" ";s$(i);" ";s$(i);" ";rr$;
- 3640 [137]3660
- 3650 [153]rr$" ";s$(i);s$(i);s$(i);" ";rr$;
- 3660 [153]
- 3670 [130]l
- 3680 [153]"":[153]
- 3690 [142]
- 3700 [153]""[170]qq$
- 3710 [153]rr$[166]5)rr$
- 3720 [153]rr$[170]"step waitfn "[170]rr$
- 3730 [153]rr$[170]" wait waitstep"[170]rr$
- 3740 [153]rr$[170]" wait (NULL)wait"[170]rr$
- 3750 [153]rr$[170]"(NULL) wait "[170]rr$
- 3760 [153]rr$[166]5)rr$
- 3770 [153]ss$
- 3780 [142]
- 3800 qq$[178]"print#(NULL)lenlenlenlenlenright$stop"
- 3810 rr$[178]"print#peekstop"
- 3820 ss$[178]"print#mid$ascascascascasc(NULL)stop"
- 3830 [142]
- 3850 qq$[178]"print#(NULL)lenlenlenlenlenright$"
- 3860 rr$[178]"print#peek"
- 3870 ss$[178]"print#mid$ascascascascasc(NULL)"
- 3880 [142]
- 3900 [143] ** buzzer
- 3905 [151]54296,15:[151]54277,45:[151]54278,165
- 3910 [151]54276,33:[151]54273,6:[151]54272,5
- 3915 [129]tt[178]1[164]200:[130]:[151]54276,32:[151]54273,0:[151]54273,0:[151]54272,0:[142]
- 3950 [143] ** bell sound
- 3955 [151]54296,15:[151]54277,0:[151]54278,247
- 3960 [151]54276,17:[151]54273,40:[151]54272,0
- 3965 [129]tt[178]1[164]200:[130]:[151]54276,16:[151]54273,0:[151]54273,0:[151]54272,0:[142]
-