home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1986 December
/
1986-12.d64
/
pegs_64
(
.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=1to39:bl$=bl$+" ":next:dc=54272:c=64:p=49152:b=0: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+22:readd:pokei,d:next
80 print"[147][144]";:poke53280,6:poke53281,15
90 print" pegs [146]";
100 sysp,2,1:print"[144]score:";s:fori=1to15:pokep(i),i:pokep(i)+dc,2
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,23,0:printbl$:sysp,23,14:print"your move";
150 inputa$:ift>1anda$="_"then340
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:gosub460
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,1:print"score:";s;"[157] ":ifs=13thengoto440
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=0then380
300 goto140
310 sysp,23,0:printbl$:sysp,23,13:print"illegal move"
320 fori=1to10:poke54296,15:forj=1to2:next:poke54296,0:forj=1to2:next:next
330 fori=1to250:next:goto140
340 t=t-1:s=s-1:fori=1to15
350 iftc(t,i)=0andtc(t+1,i)=1thenforj=1to8:pokep(i)+o(j),sp:next
360 iftc(t,i)=1andtc(t+1,i)=0thenforj=1to8:pokep(i)+o(j),c(j):next
370 next:goto250
380 sysp,23,0:printbl$:sysp,23,6:print"game over - your score is";s
390 fori=0to2100:next
400 sysp,23,0:printbl$:sysp,23,4:input"play again (y/n) or backup (_)";a$
410 ifleft$(a$,1)="y"thensysp,2,1:printbl$:s=0:goto100
420 ifa$="_"then340
430 print"[147]":end
440 sysp,23,0:printbl$:sysp,23,6:print"congratulations, you won"
450 fori=1to20:forj=1to15:poke53280,j:next:next:poke53280,6:goto400
460 pokedc+24,15:pokedc+1,110:pokedc+5,9:pokedc+6,9:pokedc+4,17:pokedc+4,16
470 return
480 data 1203,1360,1366,1517,1523,1529,1674,1680
490 data 1686,1692,1831,1837,1843,1849,1855
500 data 85,64,73,66,75,64,74,66,-41,-40,-39,1,41,40,39,-1
510 data abd,acf,bdg,bei,ceh,cfj,def,dgk,dhm
520 data ehl,ein,fim,fjo,ghi,hij,klm,lmn,mno
530 data 32,13,192,132,251,32,13,192,166,251,76,240
540 data 255,32,253,174,32,158,173,32,170,177,96