home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1986 December
/
1986-12.d64
/
pegs_vic
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
2KB
|
55 lines
10 dimp(15),o(8),c(8),tc(14,15),m$(36)
20 bl$="":fori=1to21:bl$=bl$+" ":next:dc=33792:c=64:p=828:b=2:sp=32
30 fori=1to15:readp(i):next
40 fori=1to8:readc(i):next:fori=1to8:reado(i):next
50 fori=1to18:readm$(i)
60 m$(i+18)=right$(m$(i),1)+mid$(m$(i),2,1)+left$(m$(i),1):next
70 fori=ptop+15:readd:pokei,d:next
80 print"[147][144]";:poke36879,30
90 print" pegs [146]";
100 sysp,2,0:print"[144]score";s:fori=1to15:pokep(i),i:pokep(i)+dc,0
110 next:fori=2to15:forj=1to8:pokep(i)+o(j),c(j):pokep(i)+o(j)+dc,b:next:next
120 fori=1to8:pokep(1)+o(i)+dc,b:pokep(1)+o(i),sp:next
130 t=1:fori=2to15:tc(t,i)=1:next:tc(t,1)=0:s=0
140 sysp,21,0:printbl$:sysp,21,5:print"your move";
150 inputa$:ift>1anda$="_"then330
160 iflen(a$)<>2then310
170 bm=1:fori=1to36:ifa$=left$(m$(i),1)+right$(m$(i),1)thenbm=0:mc=i:i=36
180 next:ifbm>0then310
190 mf=asc(left$(a$,1))-c:jp=asc(mid$(m$(mc),2,1))-c:mt=asc(right$(a$,1))-c
200 iftc(t,mf)=0ortc(t,mt)=1ortc(t,jp)=0then310
210 fori=1to8:pokep(mf)+o(i),sp:pokep(mt)+o(i),c(i):next
220 fori=1to8:pokep(jp)+o(i),sp:next:gosub480
230 t=t+1:fori=1to15:tc(t,i)=tc(t-1,i):next
240 tc(t,mf)=0:tc(t,mt)=1:tc(t,jp)=0:s=s+1
250 sysp,2,0:print"score";s;"[157] ":ifs=13thengoto460
260 lc=0:fori=1to36:x=tc(t,asc(left$(m$(i),1))-c)
270 y=tc(t,asc(mid$(m$(i),2,1))-c):z=tc(t,asc(right$(m$(i),1))-c)
280 ifx>0thenify>0thenifz=0thenlc=1:i=36
290 next:iflc=0then370
300 goto140
310 sysp,21,0:printbl$:sysp,21,5:print"illegal move"
320 poke36878,15:poke36874,129:fortd=1to600:next:poke36878,0:poke36874,0:goto140
330 t=t-1:s=s-1:fori=1to15
340 iftc(t,i)=0andtc(t+1,i)=1thenforj=1to8:pokep(i)+o(j),sp:next
350 iftc(t,i)=1andtc(t+1,i)=0thenforj=1to8:pokep(i)+o(j),c(j):next
360 next:goto250
370 sysp,21,0:printbl$:sysp,21,7:print"game over":print" your score is";s;
380 fori=0to4100:next
390 sysp,21,0:printbl$:sysp,21,2:print" play again (y/n)"
400 print" or backup (_)? [157]";
410 poke198,0:wait198,1:geta$
420 ifa$="y"thens=0:goto80
430 ifa$="_"thensysp,22,0:printbl$;:goto330
440 ifa$<>"n"then410
450 print"[147]":end
460 sysp,21,0:printbl$:sysp,21,6:print"you won"
470 for q1=1to20:forq2=24to30:poke36879,q2:nextq2,q1:goto390
480 poke36876,180:fora=15to0step-.3:poke36878,a:next:poke36876,0:return
490 data 4150,4236,4240,4322,4326,4330,4408,4412,4416,4420
500 data 4494,4498,4502,4506,4510
510 data 85,64,73,72,75,64,74,66,-23,-22,-21,1,23,22,21,-1
520 data abd,acf,bdg,bei,ceh,cfj,def,dgk,dhm
530 data ehl,ein,fim,fjo,ghi,hij,klm,lmn,mno
540 data 32,155,215,138,72,32,155,215,138,168,104,170,24,76,240,255