home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1986 December / 1986-12.d64 / pegs_64 (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  2KB  |  55 lines

  1. 10 dimp(15),o(8),c(8),tc(14,15),m$(36)
  2. 20 bl$="":fori=1to39:bl$=bl$+" ":next:dc=54272:c=64:p=49152:b=0:sp=32
  3. 30 fori=1to15:readp(i):next
  4. 40 fori=1to8:readc(i):next:fori=1to8:reado(i):next
  5. 50 fori=1to18:readm$(i)
  6. 60 m$(i+18)=right$(m$(i),1)+mid$(m$(i),2,1)+left$(m$(i),1):next
  7. 70 fori=ptop+22:readd:pokei,d:next
  8. 80 print"[147][144]";:poke53280,6:poke53281,15
  9. 90 print"                  pegs                  [146]";
  10. 100 sysp,2,1:print"[144]score:";s:fori=1to15:pokep(i),i:pokep(i)+dc,2
  11. 110 next:fori=2to15:forj=1to8:pokep(i)+o(j),c(j):pokep(i)+o(j)+dc,b:next:next
  12. 120 fori=1to8:pokep(1)+o(i)+dc,b:pokep(1)+o(i),sp:next
  13. 130 t=1:fori=2to15:tc(t,i)=1:next:tc(t,1)=0:s=0
  14. 140 sysp,23,0:printbl$:sysp,23,14:print"your move";
  15. 150 inputa$:ift>1anda$="_"then340
  16. 160 iflen(a$)<>2then310
  17. 170 bm=1:fori=1to36:ifa$=left$(m$(i),1)+right$(m$(i),1)thenbm=0:mc=i:i=36
  18. 180 next:ifbm>0then310
  19. 190 mf=asc(left$(a$,1))-c:jp=asc(mid$(m$(mc),2,1))-c:mt=asc(right$(a$,1))-c
  20. 200 iftc(t,mf)=0ortc(t,mt)=1ortc(t,jp)=0then310
  21. 210 fori=1to8:pokep(mf)+o(i),sp:pokep(mt)+o(i),c(i):next
  22. 220 fori=1to8:pokep(jp)+o(i),sp:next:gosub460
  23. 230 t=t+1:fori=1to15:tc(t,i)=tc(t-1,i):next
  24. 240 tc(t,mf)=0:tc(t,mt)=1:tc(t,jp)=0:s=s+1
  25. 250 sysp,2,1:print"score:";s;"[157] ":ifs=13thengoto440
  26. 260 lc=0:fori=1to36:x=tc(t,asc(left$(m$(i),1))-c)
  27. 270 y=tc(t,asc(mid$(m$(i),2,1))-c):z=tc(t,asc(right$(m$(i),1))-c)
  28. 280 ifx>0thenify>0thenifz=0thenlc=1:i=36
  29. 290 next:iflc=0then380
  30. 300 goto140
  31. 310 sysp,23,0:printbl$:sysp,23,13:print"illegal move"
  32. 320 fori=1to10:poke54296,15:forj=1to2:next:poke54296,0:forj=1to2:next:next
  33. 330 fori=1to250:next:goto140
  34. 340 t=t-1:s=s-1:fori=1to15
  35. 350 iftc(t,i)=0andtc(t+1,i)=1thenforj=1to8:pokep(i)+o(j),sp:next
  36. 360 iftc(t,i)=1andtc(t+1,i)=0thenforj=1to8:pokep(i)+o(j),c(j):next
  37. 370 next:goto250
  38. 380 sysp,23,0:printbl$:sysp,23,6:print"game over - your score is";s
  39. 390 fori=0to2100:next
  40. 400 sysp,23,0:printbl$:sysp,23,4:input"play again (y/n) or backup (_)";a$
  41. 410 ifleft$(a$,1)="y"thensysp,2,1:printbl$:s=0:goto100
  42. 420 ifa$="_"then340
  43. 430 print"[147]":end
  44. 440 sysp,23,0:printbl$:sysp,23,6:print"congratulations, you won"
  45. 450 fori=1to20:forj=1to15:poke53280,j:next:next:poke53280,6:goto400
  46. 460 pokedc+24,15:pokedc+1,110:pokedc+5,9:pokedc+6,9:pokedc+4,17:pokedc+4,16
  47. 470 return
  48. 480 data 1203,1360,1366,1517,1523,1529,1674,1680
  49. 490 data 1686,1692,1831,1837,1843,1849,1855
  50. 500 data 85,64,73,66,75,64,74,66,-41,-40,-39,1,41,40,39,-1
  51. 510 data abd,acf,bdg,bei,ceh,cfj,def,dgk,dhm
  52. 520 data ehl,ein,fim,fjo,ghi,hij,klm,lmn,mno
  53. 530 data 32,13,192,132,251,32,13,192,166,251,76,240
  54. 540 data 255,32,253,174,32,158,173,32,170,177,96
  55.