home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
UpTime Volume 1 #2
/
utv1n2s1.d64
/
concentration
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-28
|
9KB
|
286 lines
10 printchr$(8) chr$(142)chr$(147)
100 rem ***dimensions and*
110 rem ***preliminary initialization***
120 dimpf%(4,5),sc$(2),ss$(2),cd$(9),pn$(6),sc(6),cs(6),dk%(20),m1$(4)
125 dim l$(13),rl(13),cl(13), n(13)
130 pr=49156:pd=pr-2:p2=pr-4:fori=0to12:readq:pokep2+i,q:nexti:ro=251:co=252
140 data230,251,230,251,166,251,164,252,24,32,240,255,96
150 bo=53280:ba=bo+1:pt=646:cs$=chr$(147):bs$=chr$(32):rv$=chr$(18)
160 of$=chr$(146):x=rnd(-ti)
170 lg$=chr$(153):lr$=chr$(150):lb$=chr$(154):wh$=chr$(5)
180 ak$="any key to continue"
190 bl$="":fori=1to40:bl$=bl$+bs$:nexti
200 em$=left$(bl$,13):ec$=left$(bl$,5)
205 print"[147]": poke53280,5: poke53281,13
210 goto 3600: rem *** screen init ***
220 rem ***subroutines***
230 rem ***move cursor***
240 pokero,r:pokeco,c:syspr:return
250 rem ***timing loop***
260 tx=dd:iftm<>0thentx=tm
270 tx=ti+tx*30
280 iftx>tithen280
290 tm=0:return
300 rem ***get any key***
310 getz$:ifz$=""then310
315 if z$=chr$(140)then 2000
320 return
330 rem ***ring bell***
340 pokesd+4,21:tm=.75:gosub260:pokesd+4,0:return
350 rem ***print screen background***
360 printcs$:r=1:c=2:gosub240:printog$of$"round";rn;tab(12)"game";gn
370 printog$:r=0:c=26:gosub240:printvl$;:fori=1to24:syspd:printvl$;:nexti
380 r=2:c=0:gosub240:printmm$;:fori=1to25:printmm$;:nexti:printlj$
390 r=8:c=26:gosub240:printrj$;:fori=1to13:printmm$;:nexti
400 r=3:c=3:gosub240:printbu$"1"rp$"2"rp$"3"rp$"4"rp$"5"
410 r=6:c=0:gosub240:print"a"dp$"b"dp$"c"dp$"d"
420 r=0:c=27:gosub240:printbk$rv$"name score"of$
430 r=10:c=29:gosub240:printog$of$"messages":return
440 rem ***print scores***
450 r=1:c=27:gosub240:fori=1tonp:syspd:printbk$pn$(i);:ex=0
460 ifi=pthenprintrd$aw$bk$;:ex=2
470 x$=str$(sc(i)):printspc(12-len(x$)-len(pn$(i))-ex)x$
480 nexti:return
490 rem ***shuffle deck & deal***
500 r=7:c=9:gosub240:printbu$"shuffling"
510 fori=1to20:dk%(i)=i+9:nexti:n=20
520 fori=1to4:forj=1to5:x=int(rnd(1)*n)+1:pf%(i,j)=dk%(x)
530 ifx=nthendk%(n)=0:n=n-1:goto550
540 fork=xton-1:dk%(k)=dk%(k+1):nextk:dk%(n)=0:n=n-1
550 nextj,i:return
560 rem ***print blank cards***
570 fori=1to4:forj=1to5:r=rl(i):c=cl(j):gosub240:printbc$;:nextj,i
580 return
590 rem ***get and check row letter***
600 getz$:z$=z$+chr$(0):rw=asc(z$)
602 if rw=140 then 2000
605 ifrw<65orrw>68then600
610 rw=rw-64:r=17:c=33:gosub240:printz$;:return
620 rem ***get & check column number***
630 getz$:z$=z$+chr$(0):cm=asc(z$)
632 if rw=140 then 2000
635 ifcm<49orcm>53then630
640 cm=cm-48:r=21:c=33:gosub240:printz$;:return
650 rem ***erase message area***
660 r=11:c=27:gosub240:fori=1to12:syspd:printem$;:nexti:return
670 rem ***decode card and prepare***
680 rem ***card string for printing***
690 su%=pf%(rw,cm)/10:de%=pf%(rw,cm)-10*su%
700 ifde%=0thencd$=jr$:return
710 cd$=c1$+sc$(su%)+de$(de%)+c2$+sc$(su%)+ss$(su%)+c3$+sc$(su%)+de$(de%)+c4$
720 return
730 rem ***erase score area***
740 r=1:c=27:gosub240:fori=1to6:syspd:printem$;:nexti:return
750 rem ***erase card***
760 gosub240:printec$:fori=1to4:syspd:printec$;:nexti:return
770 rem ***play game***
780 rem ***entry point for 1st game***
790 sp=1:rn=1:gn=1
800 rem ***entry point-other games***
810 p=sp:gosub360:gosub450:gosub500:gosub570:goto850
820 rem ***entry point during game***
830 pokebo,5:pokeba,13:gosub660:gosub740:gosub450
840 rem **entry & recording-1st card**
850 r=12:c=28:gosub240:printbu$m1$(1);
852 r=13:c=28:gosub240:printbu$"first card"
855 r=15:c=28:gosub240:printbu$m1$(2);
857 r=17:c=33:gosub240:printbu$"?";
860 r=19:c=27:gosub240:printbu$m1$(3);
862 r=21:c=33:gosub240:printbu$"?";
865 r=24:c=28:gosub240:printbu$m1$(4);
870 gosub600
880 gosub630:gosub660:r1=rw:c1=cm
890 rem ***check if card available***
900 ifpf%(rw,cm)<>0then950
910 r=12:c=27:gosub240:printrd$"card has":sysp2:print"been used":sysp2
920 print"try again"
930 tm=4:gosub260:gosub660:goto850
940 rem ***decode & print card***
950 gosub690:d1=de%:r=rl(rw):c=cl(cm):gosub240:printcd$
960 rem***get & record 2nd card***
970 r=12:c=28:gosub240:printbu$m1$(1);
972 r=13:c=28:gosub240:printbu$"second card"
975 r=15:c=28:gosub240:printbu$m1$(2);
977 r=17:c=33:gosub240:printbu$"?";
980 r=19:c=27:gosub240:printbu$m1$(3);
982 r=21:c=33:gosub240:printbu$"?";
985 r=24:c=28:gosub240:printbu$m1$(4);
990 gosub600
1000 gosub630:gosub660:r2=rw:c2=cm
1010 rem ***check if card available***
1020 ifpf%(rw,cm)=0then1040
1030 ifr1<>r2orc1<>c2then1080
1040 r=12:c=27:gosub240:printrd$"card has":sysp2:print"been used":sysp2
1050 print"try again"
1060 tm=4:gosub260:gosub 660:goto970
1070 rem ***decode & print card***
1080 gosub690:d2=de%:r=rl(rw):c=cl(cm):gosub240:printcd$
1090 rem ***check for match***
1100 ifd1=0ord2=0ord1=d2then1210
1110 rem ***no match-reprint blank***
1120 rem ***cards after time loop***
1130 rem ***go to next player***
1140 gosub260:r=rl(r1):c=cl(c1):gosub240:printbc$:r=rl(r2):c=cl(c2):gosub240
1150 printbc$
1160 p=fnp(p):r=12:c=27:gosub240:printrd$"no match":sysp2:print"next player
1170 tm[178]4:[141]260:[137]830
1180 [143] ***cards match-update score***
1190 [143] ***erase matched cards***
1200 [143] ***check for end of game***
1210 [139]d1[178]0[175]d2[178]0[167][129]i[178]1[164]4:[141]340:[130]i:sc(p)[178]sc(p)[170]4
1220 [141]340:pf%(r1,c1)[178]0:pf%(r2,c2)[178]0:nm[178]nm[170]1:sc(p)[178]sc(p)[170]1
1230 r[178]12:c[178]27:[141]240:[153]rd$"match-!!!":[158]p2
1240 [153]"you score"
1250 [139]nm[179]9[167][158]p2:[153]"play again":[137]1270
1260 [158]p2:[153]bn$"end of":[158]p2:[153]"this game"
1270 tm[178]4:[141]260:[139]nm[178]9[167]1320
1280 r[178]rl(r1):c[178]cl(c1):[141]760:r[178]rl(r2):c[178]cl(c2):[141]760:[141]450
1290 [137]830
1300 [143] ***print game & cumulative***
1310 [143] ***scores***
1320 [153]cs$:[151]bo,0:[151]ba,0:r[178]3:c[178]11:[141]240:[153]lr$rv$"round"of$;rn;
1330 [153][163]23)rv$"game"of$;gn
1340 r[178]6:c[178]20:[141]240:[153]lg$"this total"
1350 r[178]7:c[178]8:[141]240:[153]"player hand score"
1360 [158]pd:[153]lb$;:[129]i[178]1[164]24:[153]bm$;:[130]i:[153]yw$
1370 [129]i[178]1[164]np:cs(i)[178]cs(i)[170]sc(i):[130]i
1380 [129]i[178]1[164]np:[158]pd:[153]pn$(i);:l[178][195]([196](sc(i))):[153][163]24[171]l)[196](sc(i));
1390 l[178][195]([196](cs(i))):[153][163]32[171]l)[196](cs(i)):[130]i
1400 [143] ***update starting player,***
1410 [143] ***round & game numbers***
1420 sp[178][165]p(sp):[139]sp[178]1[167]rn[178]rn[170]1:gn[178]0
1430 gn[178]gn[170]1
1440 [143] ***another game or round?***
1450 r[178]17:c[178]8:[141]240:[153]wh$"another ";
1460 [139]sp[178]1[167][153]"round? (y/n)":[137]1480
1470 [153]"game? (y/n)"
1480 [161]z$:[139]z$[178]""[176](z$[179][177]"y"[175]z$[179][177]"n")[167]1480
1490 [139]z$[178]"n"[167][151]bo,5:[151]ba,13:[151]pt,1:[137]2000
1500 [129]i[178]1[164]6:sc(i)[178]0:[130]i:nm[178]0:[153]cs$:[151]ba,13:[151]bo,5:[137]810
1510 [143]***print opening screen***
1520 [153]cs$:[151]bo,0:[151]ba,0:r[178]9:c[178]15:[141]240:[153]lg$"welcome to"
1530 r[178]11:c[178]13:[141]240:[153]lr$rv$"concentration"of$
1540 r[178]13:c[178]9:[141]240:[153]lb$"(c)1987 by jim speers."
1545 r[178]15:c[178]1:[141]240:[153]lb$"published by softdisk publishing, inc."
1550 r[178]11:c[178]13:[141]240:[129]i[178]1[164]5:[158]pr:[153]lr$"concentration":tm[178].5:[141]260
1560 [158]pr:[153]rv$"concentration"of$:tm[178].5:[141]260:[130]i
1570 r[178]17:c[178]10:[141]240:[153]wh$ak$:[141]310:
1580 [158]pr:[153]bl$:r[178]17:c[178]9:[141]240:[153]"one moment, please...."
1590 [137]1620
1600 [143] ***initialize variables***
1610 [143] *graphic & control characters*
1620 rd$[178][199](28):sc$(1)[178]rd$:bk$[178][199](144):sc$(2)[178]bk$:bu$[178][199](31)
1630 bn$[178][199](149):og$[178][199](129):gn$[178][199](30):lj$[178][199](179):rj$[178][199](171)
1640 tm$[178][199](164):lm$[178][199](167):rm$[178][199](165):bm$[178][199](163):cb$[178][199](166)
1650 cm$[178][199](191):ey$[178][199](119)
1660 ns$[178][199](113):mr$[178][199](106):mm$[178][199](96):ml$[178][199](107):ss$(1)[178][199](115)
1670 ss$(2)[178][199](97):aw$[178][199](95)[170]mm$
1680 [143] ***character sub-strings***
1690 dn$[178][199](17):rt$[178][199](29):lf$[178][199](157):nl$[178]lf$[170]lf$[170]lf$[170