home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1986 December / 1986-12.d64 / pegs_vic (.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=1to21:bl$=bl$+" ":next:dc=33792:c=64:p=828:b=2: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+15:readd:pokei,d:next
  8. 80 print"[147][144]";:poke36879,30
  9. 90 print"         pegs         [146]";
  10. 100 sysp,2,0:print"[144]score";s:fori=1to15:pokep(i),i:pokep(i)+dc,0
  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,21,0:printbl$:sysp,21,5:print"your move";
  15. 150 inputa$:ift>1anda$="_"then330
  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:gosub480
  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,0:print"score";s;"[157] ":ifs=13thengoto460
  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=0then370
  30. 300 goto140
  31. 310 sysp,21,0:printbl$:sysp,21,5:print"illegal move"
  32. 320 poke36878,15:poke36874,129:fortd=1to600:next:poke36878,0:poke36874,0:goto140
  33. 330 t=t-1:s=s-1:fori=1to15
  34. 340 iftc(t,i)=0andtc(t+1,i)=1thenforj=1to8:pokep(i)+o(j),sp:next
  35. 350 iftc(t,i)=1andtc(t+1,i)=0thenforj=1to8:pokep(i)+o(j),c(j):next
  36. 360 next:goto250
  37. 370 sysp,21,0:printbl$:sysp,21,7:print"game over":print"   your score is";s;
  38. 380 fori=0to4100:next
  39. 390 sysp,21,0:printbl$:sysp,21,2:print" play again (y/n)"
  40. 400 print"    or backup (_)? [157]";
  41. 410 poke198,0:wait198,1:geta$
  42. 420 ifa$="y"thens=0:goto80
  43. 430 ifa$="_"thensysp,22,0:printbl$;:goto330
  44. 440 ifa$<>"n"then410
  45. 450 print"[147]":end
  46. 460 sysp,21,0:printbl$:sysp,21,6:print"you won"
  47. 470 for q1=1to20:forq2=24to30:poke36879,q2:nextq2,q1:goto390
  48. 480 poke36876,180:fora=15to0step-.3:poke36878,a:next:poke36876,0:return
  49. 490 data 4150,4236,4240,4322,4326,4330,4408,4412,4416,4420
  50. 500 data 4494,4498,4502,4506,4510
  51. 510 data 85,64,73,72,75,64,74,66,-23,-22,-21,1,23,22,21,-1
  52. 520 data abd,acf,bdg,bei,ceh,cfj,def,dgk,dhm
  53. 530 data ehl,ein,fim,fjo,ghi,hij,klm,lmn,mno
  54. 540 data 32,155,215,138,72,32,155,215,138,168,104,170,24,76,240,255
  55.