home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 113
/
113.d81
/
calculation
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
6KB
|
185 lines
10 poke56,56:poke55,0:clr
15 print"[147]":poke53281,0:poke53280,0:gosub60000
20 dv=peek(186):ifdv<8thendv=8
30 sys57812"calc font",dv,0:poke780,0:poke781,0:poke782,56:sys65493
40 sys57812"calc 0340-03c0",dv,0:poke780,0:poke781,64:poke782,3:sys65493
50 sys57812"calc c000-c149",dv,0:poke780,0:poke781,0:poke782,192:sys65493
60 poke53272,31
70 gosub1150:gosub1090
80 gosub940:dl=1:cr=48:gm=gm+1
90 rem :: play ::
100 syssp,0,1:m1=0:m2=0:c1=9:goto200
110 js=peek(56320)and31:geta$:ifjs=31anda$=""then110
120 ifa$="v"then570
130 ifa$="q"then650
135 ifa$="h"then1400
140 ifjs=15ora$=chr$(13)then230
150 if(js=27ora$="[157]")andm2=0thenm1=m1-1-(m1=0)*1
160 if(js=23ora$="")andm2=0thenm1=m1+1+(m1=4)*1
170 ifjs=30ora$="[145]"thenm2=m2-1-(m2=0)*1
180 ifjs=29ora$=""thenm2=m2+1+(m2=4)*1
190 ifm2>0thensyssp,0,1,37+lr(m2)*24,65+m2*40:m1=0
200 ifm2=0thensyssp,0,1,37+m1*40,65
210 goto110
220 :: choose ::
230 ifm2=0then410
240 iflr(m2)=12orc1=9orwr(c1)<0then110
250 t3=u1:t4=u2:ifc1>0thent3=wp(c1,wr(c1),0):t4=wp(c1,wr(c1),1)
260 t=lo(m2,lr(m2),1)+m2:t=t+(t>13)*13:ift<>t4thengosub760:goto390
270 syssp,1,0:ifc1=0then320
280 :
290 wr(c1)=wr(c1)-1:ifwr(c1)<0thensyspa,c1*5,0,nc$:goto350
300 syspa,c1*5,0:c3=wp(c1,wr(c1),0):c4=wp(c1,wr(c1),1):gosub1050:goto350
310 :
320 ifdp=52thensyspa,0,0,ec$:goto350
330 syspa,0,0,uc$
340 :
350 syspa,2+lr(m2)*3,m2*5:c3=t3:c4=t4:gosub1040:gosub730
360 lr(m2)=lr(m2)+1:lo(m2,lr(m2),0)=t3:lo(m2,lr(m2),1)=t4:c1=9
370 iflr(m2)<12thent=t+m2:t=t+(t>13)*13:print" "mid$("a23456789[166]jqk",t,1)
380 m1=0:m2=0:cr=cr-1:ifcr=0then640
390 wait56320,16,15:goto200
400 :: deck/piles ::
410 ifm1=0then510
420 ifur(m1)<0andc1>0then550
430 ifc1>0then540
440 :
450 t$=uc$:ifdp=52thent$=ec$
460 syssp,1,0:syspa,0,0,t$
470 syspa,m1*5,0:c3=u1:c4=u2:gosub1050:gosub790
480 wr(m1)=wr(m1)+1:wp(m1,wr(m1),0)=u1:wp(m1,wr(m1),1)=u2:c1=9
490 m1=0:m2=0:goto550
500 :
510 ifdp=52orc1=0then550
520 dp=dp+1:u1=dk(dp,0):u2=dk(dp,1)
530 syspa,0,0:c3=u1:c4=u2:gosub1050
540 syssp,1,1,7+m1*40,54:c1=m1:gosub790
550 wait56320,16,15:goto200
560 :: view card ::
570 t=wr(m1):ift<1then110
580 t=t-1:ift<0thengosub790:goto600
590 syspa,5*m1,0:c3=wp(m1,t,0):c4=wp(m1,t,1):gosub1050
600 js=peek(56320)and31:geta$
602 ifjs=31anda$=""then600
604 ifjs=15ora$="v"then580
610 syspa,5*m1,0:c3=wp(m1,wr(m1),0):c4=wp(m1,wr(m1),1):gosub1050
620 goto140
630 :: quit ::
640 forl=0to7:gosub790:next
650 t=0:tc=tc+cr:pokeso,0:gosub1090
660 syspa,11,10,"[192][192][192][192] game #"right$(" "+mid$(str$(gm),2),2)" [192][192][192][192]"
670 syspa,11,12,"cards remaining:"cr
680 syspa,11,14,"average / game: "int(tc/gm+.5)
690 syspa,8,21,"fire or return - new game
695 [158]pa,10,23,"q - quit to loadstar"
700 [141]790
702 js[178][194](56320)[175]31:[161]a$
703 [139]a$[178]"q"[167]40000
704 [139]js[179][177]15[175]a$[178]""[167]702
706 [151]198,0:[158]f1
710 [137]80
720 :: bing ::
730 [151]at,10:[151]sr,73:[151]wv,17:[151]hf,50:[151]lf,0:[129]j[178]0[164]333:[130]:[151]wv,16
740 [142]
750 :: buzz ::
760 [151]hf,6:[151]at,0:[151]sr,240:[151]wv,33:[129]j[178]0[164]199:[130]:[151]wv,32
770 [142]
780 :: beep ::
790 [151]sr,240:[151]wv,17:[151]hf,50:[151]lf,35:[151]at,0:[129]j[178]1[164]99:[130]:[151]wv,16
800 [142]
810 :: shuffle ::
820 [158]pa,11,13,"shuffling the deck":[141]790
830 [139]dl[167]850
840 t[178]1:[129]l[178]1[164]52:dl(l)[178]t:t[178]t[170]1:[130]
850 [129]l[178]1[164]52
860 t1[178][181]([187](1)[172]48[170]5):t2[178][181]([187](1)[172]48[170]5):t[178]dl(t1):dl(t1)[178]dl(t2):dl(t2)[178]t
870 [130]
880 [129]l[178]1[164]52
890 dk(l,0)[178][181]((dl(l))[173]13[170].99)
900 dk(l,1)[178]dl(l)[171]13[172][181]((dl(l)[171]1)[173]13)
910 [130]
920 [142]
930 :: deal ::
940 dp[178][187](0):dp[178]0:[141]820:[158]f1
950 [129]l[178]1[164]4:lr(l)[178]0:wr(l)[178][171]1:dp[178]dp[170]1
960 [158]pa,0,l[172]5:c3[178]dk(dp,0):c4[178]dk(dp,1):[141]1050:[153]""l[172]2
970 lo(l,0,0)[178]c3:lo(l,0,1)[178]c4
980 [130]
990 [158]pa,25,3,"(NULL)iewcmdcmdcmdtab(tab(tab(on (NULL)uitcmdcmdcmdtab(tab(tab(on (NULL)elpcmdcmdcmdtab(tab(tab("
1000 [158]pa,0,0,uc$
1010 [129]l[178]0[164]3:[158]pa,5[170]l[172]5,0,nc$:[130]
1020 [142]
1030 :: display card ::
1040 [153]"waitlist(NULL)cmd(NULL)cmd(NULL)cmd(NULL)ononon";
1050 [153]ct$(c3)tp$(c4)" (NULL)cmdcmdcmdcmd"cb$(c3)st$(c3)" cmdcmdcmdcmd ";
1060 [153]sb$(c3)"cmdcmdcmdcmd(NULL)wait "ct$(c3)bt$(c4);
1070 [142]
1080 :: screen ::
1090 [151]53280,5:[151]53281,1
1100 [153]" ortantantantantantantantantantantantantan^ ";
1110 [153]" (NULL) calculation (NULL) ";
1120 [153]" /tantantantantantantantantantantantantanexp ":[158]f1
1130 [142]
1140 :: initialize ::
1150 [153]"load"
1160 [134] c1,c3,c4,cr,dp,gm,js,kb,t,t1,t2,t3,t4,j,k,l,m1,m2,dl,tc,u1,u2,t$
1170 [134] tp$(13),bt$(13),dk(52,1),dl(52),lo(4,12,1),wp(4,47,1),lr(4),wr(4)
1180 [134] ct$(4),cb$(4),st$(4),sb$(4)
1190 ec$[178]" cmdcmdcmdcmd cmdcmdcmdcmd cmdcmdcmdcmd "
1200 uc$[178]"wait(NULL) (NULL)cmdcmdcmdcmd open wait cmdcmdcmdcmd wait cmdcmdcmdcmd(NULL)wait (NULL)"
1210 nc$[178]"ortantan^cmdcmdcmdcmd(NULL) (NULL)cmdcmdcmdcmd(NULL) (NULL)cmdcmdcmdcmd/tantanexp"
1220 lf[178]54272:hf[178]54273:wv[178]54276:at[178]54277:sr[178]54278:[151]lf[170]24,15:cm[178]49408
1230 f1[178]49152:f2[178]49155:pa[178]49158:sp[178]49161:so[178]53269:[151]2040,13:[151]2041,14
1240 [151]53276,1:[151]53285,7:[151]53287,11:[151]53288,6:[151]53277,2:[151]53271,2
1250 [129]l[178]1[164]13:[135]tp$(l),bt$(l):[130]
1260 [129]l[178]1[164]4:[135]ct$(l),cb$(l),st$(l),sb$(l):[130]
1270 [142]
1280 [131] "peek "," peek","len "," len","str$ "," str$","val "," val","asc "," asc"
1290 [131] "chr$ "," chr$","left$ "," left$","right$ "," right$","mid$ "," mid$"
1300 [131] "(NULL)(NULL)","(NULL)(NULL)","(NULL) "," (NULL)","(NULL) "," (NULL)","(NULL) "," (NULL)"
1310 [131] "waitprint#","waitstop","atn","atn","waitdef","wait","(NULL)","(NULL)"
1320 [131] "waitdef","wait","(NULL)","(NULL)","waitprint#","waitstop","(NULL)","(NULL)"
1400 [158]cm,1024,16384,1000:[158]cm,55296,17384,1000
1405 sq[178][194](so):[151]so,0:sw[178][194](199):[151]199,0
1410 [151]53281,5:[153]"load the rules for syscalculation"
1412 [153]" to win calculation, play all of the
1414 print"cards from the deck (upper left corner)
1416 [153]"to the four rows below. the top row
1418 print"increases by one, the second by two,
1420 [153]"the third by three and the fourth by
1422 print"four. the next card in the sequence is
1424 [153]"shown where it is to be played. if the
1426 print"card won't play, drop it on any of the
1428 [153]"four discard piles (top). the top cards
1430 print"of the deck and the four discard piles
1432 [153]"are available for play.
1436 print" move the arrow with the crsr keys or
1438 [153]"the joystick. select with return or
1440 print"fire, then move to where you want to
1442 [153]"move it and press returncloseor fire.
1450 print" press v with the arrow on a discard
1452 [153]"pile to see the cards underneath.
1460 print" press q to quit.
1462 [153]" printpress return or fire"
1470 js[178][194](56320)[175]31:[161]a$:[139]js[179][177]15[175]a$[179][177][199](13)[167]1470
1490 [151]53281,1
1500 [158]cm,16384,1024,1000:[158]cm,17384,55296,1000
1510 [151]so,sq:[151]199,sw:[137]110
10000 [159]15,8,15,"s0:calculation":[160]15:[148]"calculation",8:[128]
40000 a$[178]"hello connect":[129]i[178]8[164]9:[160]2:[159]2,i,2:[160]2:[139]st[167]40020
40010 [160]15:[159]15,i,15,"r0:"[170]a$[170]"="[170]a$:[132]15,er:[160]15:[139]er[178]63[167]40030
40020 [130]:[153]"load":[151]2048,0:[151]44,8:[151]53272,23:[151]186,8:[128]
40030 [151]53281,0:[153]"loadstopload"[199](34)a$[199](34)","i
40040 [153]"run":[151]44,8:[151]2048,0:[151]631,13:[151]632,13:[151]198,2:[128]
60000 [153]"load":z$[178]" print# ":[151]214,10:[153]
60010 [153]" listfrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefrefre":[129]i[178]0[164]11:[153]z$:[130]
60020 [153]" pokepospospospospospospospospospospospospospospospospospospospospospo