home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1985 June
/
1985-06.d64
/
squares
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
2KB
|
72 lines
10 poke53281,0:poke53280,0:print"[147]"
20 dimin(15,4):fora=984to1023:pokea,32:next
30 dr(0)=-40:dr(1)=1:dr(2)=40:dr(3)=-1
40 cl(1)=3:cl(2)=4:cl(3)=11:cl(4)=9
50 p(1)=1360:p(2)=1358:p(3)=1440:p(4)=1438:co=54272
60 forx=1to4:p(x)=1024+int(rnd(1)*15)*2+int(rnd(1)*10)*80:next
70 goto560
80 print"[147]";:forx=1to10:fory=1to15:print"[209] ";:next:print:print:next
90 gosub630:printtab(22);" i[157][157]j[219]k[157][157]m"
100 qf=1:forpl=1to4:p=p(pl):cl=cl(pl):q=0:fl=0
110 p1=p:gosub380:p2=si:lf=0
120 gosub470:gosub630:print"player"pl"'s turn";:poke646,cl:print" [209]"
130 print " "
140 gosub380
150 in=in(si,pl):ifin=0thengosub290
160 goto500
170 ifabs(in)=1thenpokep+in,67:goto190
180 pokep+in,66
190 pokep+co,1:pokep+co+in*2,cl:pokep+in+co,cl
200 p(pl)=p+in*2:gosub410
210 if(s1=15)and(peek(x+d)=32)thenpokex+d,160:pokex+d+co,cl:b(pl)=b(pl)+1
220 if(s2=15)and(peek(x-d)=32)thenpokex-d,160:pokex-d+co,cl:b(pl)=b(pl)+1
230 p=p(pl):gosub520
240 gosub380:ifp1=pandp2=sithenlf=1:q=9
250 ifq=>9then270
260 q=q+1:goto140
270 iflf=0thenqf=0
280 nextpl:goto640
290 gosub630:print"what direction":pokep+co,cl:poke198,0
300 ifty(pl)=2thengosub340:q=10:goto330
310 geta$:ifa$<>"i"anda$<>"m"anda$<>"j"anda$<>"k"then310
320 q=10:d=(a$="j")*-3+(a$="k")*-1+(a$="m")*-2
330 in(si,pl)=dr(d):in=in(si,pl):return
340 ifsi=15thend=int(rnd(1)*4):return
350 iffl=>4thend=int(rnd(1)*4):return
360 d=int(rnd(1)*4):if(siand2^d)=2^dthen360
370 fl=fl+1:return
380 si=0:forx=0to3:i=peek(dr(x)+p)
390 ifi<>32thensi=si+2^x
400 next:return
410 s1=0:s2=0:x=(p(pl)+p)/2:ifabs(x-p)=1thend=40:goto430
420 d=1
430 fory=0to3:z=peek(x+dr(y)+d):if(z=66)or(z=67)thens1=s1+2^y
440 next
450 fory=0to3:z=peek(x+dr(y)-d):ifz=(66)or(z=67)thens2=s2+2^y
460 next:return
470 gosub630:print" "
480 print" "
490 print" ":goto520
500 ifpeek(p+in*2)=81then170
510 gosub630:print:gosub480:gosub630:print"illegal move":gosub290:goto140
520 print"":forx=1to4
530 print tab(29);" plr."x;:poke646,cl(x):print"[209]"
540 printtab(30);b(x):next
550 return
560 print"[147][129]"spc(16)"squares"
570 print" [159]1. player controlled
580 [153]" 2. computer controlled
590 forx=1to4
600 print"[158] snake "x" (choose 1 or 2)"
610 geta$:ifval(a$)>2orval(a$)=0then610
620 ty(x)=val(a$):next:goto80
630 print"":forqq=1to18:print:next:return
640 ifqf=0then100
650 print"[147]"spc(14)"[129]game over!"
660 forx=1to4:poke 646,cl(x):printtab(7)"player"x;"...."b(x)" squares"
670 next
680 print""spc(10)"another game? (y/n)":poke198,0
690 geta$:ifa$="y"thenrun
700 ifa$="n"thenprint"[147]":end
710 goto690