home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 124
/
124.d81
/
chum.bas
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
8KB
|
289 lines
10 rem@ s 1024
20 dimh(105,4),x(36),y(36),g(6,6),gg(105),e(3),m$(4),ms$(3),mm$(3),u(3),uu(3)
22 dimgk(6,6)
30 dv=peek(186):ifdv<8thendv=8
32 i=rnd(-ti)
40 poke53280,0
42 close15:open15,dv,15,"r0:chum scores=chum scores":input#15,er:close15
44 ifer<>63then90
60 close2:open2,dv,2,"chum scores,s,r"
70 fori=1to3:input#2,u(i):input#2,uu(i):next
80 close2
90 poke53270,216:poke53265,11
100 cb=0:poke53281,cb:poke53282,14:poke53283,14:print"[147]"
110 poke53272,25
120 goto670
130 :
140 :rem checkerboard
150 :
160 print"[154]";:fori=0to5:forj=0to5
170 poke214,2+i*2:print
180 printtab(11+j*3)ck$(0)
190 next:next
200 return
210 :
220 :rem box
230 :
240 poke214,y:print:poke646,c
250 printtab(x)"[176]"left$(h$,xx)"[174]"
260 fori=1toyy:printtab(x)"[221]"tab(x+xx+1)"[221]":next
270 printtab(x)"[173]"left$(h$,xx)"[189]"
280 return
290 :
300 :rem message
310 :
320 poke214,18:print
330 fori=0to2:printtab(3)"[159]"left$(sp$,34)"[145]"
340 print""tab(20-(len(ms$(i))/2))ms$(i)
350 next
360 return
370 :
380 :rem sounds
390 :
400 s=54272:pokes+1,sd*20:pokes+5,9
410 pokes+15,sd*11:pokes+24,15:pokes+4,21
412 ti$="000000"
414 ifti<30then414
420 pokes+4,20
430 return
440 :
450 :rem prompt
460 :
470 ms$(0)="[195][193][204][200][207][207][206]'[211] [195][200][213][205] [195][200][193][204][204][197][206][199][197]"
480 ms$(1)="[217]our opponent: "+mm$(lv/4)
490 ms$(2)="([209])uit ([200])elp ([211])cores":gosub320
500 return
510 :
520 :rem check for square
530 :
540 n=y*6+x
550 fori=0to104
560 forj=0to3
570 ifh(i,j)<>nthen610
580 pq=0:fl=-1:fork=0to3:ifk=jthen600
590 ifgg(h(i,k))<>pthenpq=1:k=3
600 next:ifpq=0thenfl=i:j=3:i=104
610 next
620 next
630 return
640 :
650 :rem startup
660 :
670 print"[147]"
680 ck$(0)="[173][174][175][157][157][157][176][177][178]":ck$(1)="[161][162][163][157][157][157][164][165][166]":ck$(2)="[167][168][169][157][157][157][170][171][172]"
690 bg$="\[\[\[\[\[\[\[\[\[\[\[\[\[\[\[\[\[\[\[\[\"
700 bh$="[\[\[\[\[\[\[\[\[\[\[\[\[\[\[\[\[\[\[\[\["
710 h$="[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
720 sp$=" "
722 m$(1)=" [198]enton [200]ardy ":mm$(1)="[198]enton"
724 m$(2)=" [198]rank and [202]oe ":mm$(2)="[200]ardys"
725 m$(3)=" [195]het [205]orton ":mm$(3)="[195]het"
726 m$(4)=" [209]uit "
730 ms$(1)=left$(sp$,34)
740 pl$(1)="[199][210][197][197][206]":pl$(2)="[210][197][196]"
750 e(0)=14:e(1)=10:e(2)=13
760 z=40:w=1024+11+2*z
770 s=54272:fori=stos+24:pokei,0:next
780 fori=0to104:forj=0to3
790 readh(i,j)
800 next:next
810 co(0)=0:co(1)=0:co(2)=2:co(3)=7
820 fori=828to970:reada:pokei,a:next
830 fori=0to35:x(i)=11+3*(i-int(i/6)*6):y(i)=2+2*int(i/6):next
840 print"";:fori=0to11:printleft$(bg$,40);:printright$(bg$,40);:next
850 printleft$(bg$,38)"[157][157][148][148]\["
860 fori=217to242:pokei,peek(i)or128:next
861 p=1
862 x=10:y=1:xx=18:yy=12:c=3:gosub240
863 fori=0to11:poke214,2+i:print:printtab(11)""left$(sp$,18):next
864 poke214,3:print:printtab(13)"[195][193][204][200][207][207][206]'[211] [195][200][213][205]"
866 printtab(15)"[195][200][193][204][204][197][206][199][197]"
868 fori=1to4:print""tab(12)m$(i):next
870 x=2:y=17:xx=34:yy=3:c=3:gosub240
872 ms$(0)="":ms$(1)="[195]hoose your opponent":ms$(2)="":gosub320
876 m=1:poke53265,27
878 poke214,4+m*2:print:printtab(12)""m$(m)"[145]"
880 jy=peek(56320):geta$:ifa$=""andjy=127then880
882 poke214,4+m*2:print:printtab(12)"[159]"m$(m)"[145]"
884 ifa$=chr$(13)orjy<112thensd=int(rnd(1)*5)+2:gosub400:goto890
885 ifa$=""orjy=125thenm=m+1:ifm>4thenm=1
886 ifa$="[145]"orjy=126thenm=m-1:ifm<1thenm=4
887 goto878
890 ifm=4then1530
892 lv=m*4:co=1
896 x=2:y=17:xx=34:yy=3:c=3:gosub240
898 gosub160:sys886
900 gosub470
920 fori=0to5:forj=0to5:g(i,j)=0:next:next
930 fori=0to104:gg(i)=0:next:xd=0:yd=0
947 :
948 :rem loop
949 :
950 ifp=1thenx=xd:y=yd:goto980
952 w=0
960 x=int(rnd(1)*6):y=int(rnd(1)*6)
970 ifg(x,y)then960
980 poke646,e(p)
990 poke214,2+y*2:print:printtab(11+3*x)ck$(1)"[145][157][157][157]";
1000 fori=0to40:next
1010 printck$(0)"[145][157][157][157]";
1012 fori=0to30:next
1020 ifp=2thensd=10:gosub400:gosub540:goto1160
1030 jy=peek(56320):geta$:ifa$=""andjy=127then990
1040 ifa$=chr$(13)orjy<112then1140
1050 k=0:ifg(x,y)thenk=1
1060 poke646,e(g(x,y)):printck$(k)
1070 ifa$="[145]"orjy=126theny=y-1:ify<0theny=5
1080 ifa$=""orjy=125theny=y+1:ify>5theny=0
1090 ifa$="[157]"orjy=123thenx=x-1:ifx<0thenx=5
1100 ifa$=""orjy=119thenx=x+1:ifx>5thenx=0
1110 ifa$="h"thensys928:gosub1300:sys949:goto980
1112 ifa$="s"thensd=4:gosub400:sys928:sq=1:goto1276
1120 ifa$="q"thensd=3:gosub400:gosub1470:goto980
1130 goto980
1140 ifg(x,y)thensd=1:gosub400:goto980
1150 sd=11:gosub400:gosub540:rem square?
1160 iffl>-1then1202
1170 g(x,y)=p:gg(x+6*y)=p
1172 ifp=1thenxd=x:yd=y
1180 sd=6:gosub400:poke646,e(p):printck$(1)
1182 fori=0to5:forj=0to5:gk(i,j)=0:next:next
1190 p=p+1:ifp>2thenp=1
1192 co=co+1
1200 goto950
1202 ifp=1then1218
1204 iflv<12then1216
1206 ifco<20then1216
1208 fori=0to5:forj=0to5
1210 ifg(i,j)orgk(i,j)then1214
1212 x=i:y=j:gk(i,j)=1:i=5:j=5:next:next:goto980
1214 next:next:goto1218
1216 ifw<lvthenw=w+1:goto960
1218 ms$(1)="":ms$(0)=pl$(p)+" wins!!!":ms$(2)="[208]ress a key":gosub320
1220 fori=0to3
1230 poke214,y(h(fl,i)):print:printtab(x(h(fl,i)))ck$(1):next:zz=1-zz
1240 ifzzthenpoke646,0
1250 ifzz=0thenpoke646,e(p)
1260 jy=peek(56320):geta$:ifa$=""andjy=127then1220
1262 ifp=1thenu(lv/4)=u(lv/4)+1
1264 ifp=2thenuu(lv/4)=uu(lv/4)+1
1266 close15:open15,dv,15,"s0:chum scores":close15
1268 close2:open2,dv,2,"chum scores,s,w"
1270 fori=1to3
1272 print#2,u(i):print#2,uu(i)
1274 next:close2
1276 fori=0to11:poke214,2+i:print:printtab(11)"[159]"left$(sp$,18):next
1278 poke214,3:print:printtab(15)"[211] [195] [207] [210] [197] [211]"
1280 printtab(13)"[195][200][213][205] [215] [204]"
1281 printtab(13)"---- - -"
1282 fori=1to3:print:print""tab(12)mm$(i)tab(20)u(i)tab(24)uu(i):next
1284 ms$(0)="":ms$(1)="[208]ress a key":ms$(2)="":gosub320
1286 jy=peek(56320):geta$:ifa$=""andjy=127then1286
1287 ifsqthensq=0:sys949:goto980
1288 pz=1-pz
1290 p=1:ifpzthenp=2
1298 goto863
1300 ms$(0)="[208]layers take turns. [212]he first one
1304 ms$(1)[178]"who cannot play without making a
1310 ms$(2)="square loses. [208]ress a key.":gosub320
1314 sd=4:gosub400
1320 jy=peek(56320):geta$:ifa$=""andjy=127then1320
1330 ms$(0)="[208]ress any key to see examples of
1340 ms$(1)[178]"what makes a square. (NULL)ress (NULL)val(NULL)(NULL)(NULL)(NULL)
1350 ms$(2)="to return to the game.":gosub320:gosub160
1360 r=int(rnd(1)*105)
1370 fori=0to3:print"[150]";
1380 poke214,y(h(r,i)):print:printtab(x(h(r,i)))ck$(1):next
1390 jy=peek(56320):geta$:ifa$=""andjy=127then1390
1400 fori=0to3
1410 poke214,y(h(r,i)):print:printtab(x(h(r,i)))ck$(0):next
1420 ifa$=chr$(13)orjy<112thenreturn
1430 goto1360
1440 :
1450 :rem quit
1460 :
1470 sys928
1480 ms$(1)="[209]uit? [193]re you sure? (y/n)":ms$(0)=" ":ms$(2)=" ":gosub320
1490 geta$:ifa$=""then1490
1500 ifa$="y"then863
1510 sys949
1520 return
1530 print"[147]":poke53270,200
1540 a$="hello connect":fori=8to13:close2:open2,i,2:close2:ifstthen1560
1550 close15:open15,i,15,"r0:"+a$+"="+a$:input#15,er:close15:ifer=63then1570
1560 next:print"[147][146]":poke2048,0:poke44,8:poke43,1:poke53272,23:poke186,8:end
1570 poke646,peek(53281):print"[147][146]load"chr$(34)a$chr$(34)","i:poke43,1
1580 print"run":poke44,8:poke2048,0:poke631,13:poke632,13:poke198,2:end
1587 :
1588 :rem h(104,4)
1589 :
1590 data0,1,6,7,0,2,12,14,0,3,18,21,0,4,24,28,0,5,30,35
1600 data1,2,7,8,1,3,13,15,1,4,19,22,1,5,25,29
1610 data2,3,8,9,2,4,14,16,2,5,20,23
1620 data3,4,9,10,3,5,15,17
1630 data4,5,10,11
1640 data6,7,12,13,6,8,18,20,6,9,24,27,6,10,30,34
1650 data7,8,13,14,7,9,19,21,7,10,25,28,7,11,31,35
1660 data8,9,14,15,8,10,20,22,8,11,26,29
1670 data9,10,15,16,9,11,21,23
1680 data10,11,16,17
1690 data12,13,18,19,12,14,24,26,12,15,30,33
1700 data13,14,19,20,13,15,25,27,13,16,31,34
1710 data14,15,20,21,14,16,26,28,14,17,32,35
1720 data15,16,21,22,15,17,27,29
1730 data16,17,22,23
1740 data18,19,24,25,18,20,30,32
1750