home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1987 July & August / rerun-1987-07-08.d64 / pegboard (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  3KB  |  110 lines

  1. 1 rem pegboard 64 (c) 1986 john olsen
  2. 10 poke53280,0:poke53281,0:n%=9:m%=81:o%=80:p%=160:q%=156:r%=400:s=54272
  3. 20 poke53265,peek(53265)and239
  4. 30 print"[147][156]"chr$(142)chr$(8)tab(14)"[176][192][192][192][192][192][192][192][192][192][174]"
  5. 40 printtab(14)"[221][158]peg board[156][221]"
  6. 50 printtab(14)"[173][192][192][192][192][192][192][192][192][192][189]"
  7. 60 printtab(13)"[158]by john olsen"
  8. 70 print"[159]remove one"tab(31)"diagonal"
  9. 80 print"peg at a"tab(34)"jumps"
  10. 90 print"time, by"tab(32)"are not"
  11. 100 print"jumping"tab(32)"allowed"
  12. 110 print"over it"
  13. 120 print"with an"
  14. 130 print"adjacent"
  15. 140 print"peg"tab(31)
  16. 150 printtab(32)"you win"
  17. 160 print"use your"tab(31)"when one"
  18. 170 print"joystick"tab(31)"peg only"
  19. 180 print"in port 2"tab(32)"remains"
  20. 190 print""tab(15)"[144]+ + + + +"
  21. 200 printtab(16)"[176][192][178][192][178][192][174]"
  22. 210 printtab(15)"[144]+[221] [221] [221] [221][144]+"
  23. 220 printtab(16)"[171][192][219][192][219][192][179]"
  24. 230 printtab(11)"[144]+ + +[221] [221] [221] [221][144]+ + +"
  25. 240 printtab(12)"[176][192][178][192][219][192][219][192][219][192][219][192][178][192][174]"
  26. 250 printtab(11)"[144]+[221] [221] [221] [221] [221] [221] [221] [221][144]+"
  27. 260 printtab(12)"[171][192][219][192][219][192][219][192][219][192][219][192][219][192][179]"
  28. 270 printtab(11)"[144]+[221] [221] [221] [221] [221] [221] [221] [221][144]+"
  29. 280 printtab(12)"[171][192][219][192][219][192][219][192][219][192][219][192][219][192][179]"
  30. 290 printtab(11)"[144]+[221] [221] [221] [221] [221] [221] [221] [221][144]+"
  31. 300 printtab(12)"[173][192][177][192][219][192][219][192][219][192][219][192][177][192][189]"
  32. 310 printtab(11)"[144]+ + +[221] [221] [221] [221][144]+ + +"
  33. 320 printtab(16)"[171][192][219][192][219][192][179]"
  34. 330 printtab(15)"[144]+[221] [221] [221] [221][144]+"
  35. 340 printtab(16)"[173][192][177][192][177][192][189]"
  36. 350 printtab(15)"[144]+ + + + +"
  37. 360 print""tab(17)"[158][209][150][209][209]"
  38. 370 printtab(17)"[209][209][209]"
  39. 380 printtab(13)"[209][209][209][209][209][209][209]"
  40. 390 printtab(13)"[209][209][209] [209][209][209]"
  41. 400 printtab(13)"[209][209][209][209][209][209][209]"
  42. 410 printtab(17)"[209][209][209]"
  43. 420 printtab(17)"[209][209][209]"
  44. 430 poke53265,peek(53265)or16
  45. 440 bl=1361:l=bl
  46. 450 ll=l
  47. 460 pokes+4,0:pokes+23,0:pokes+22,0
  48. 470 p=255-(peek(56464)or128)
  49. 480 ifpand16then590
  50. 490 ifpand1thenl=l-o%
  51. 500 ifpand2thenl=l+o%
  52. 510 ifpand4thenl=l-2
  53. 520 ifpand8thenl=l+2
  54. 530 ifl=llthen470
  55. 540 ifpeek(l)=43thenl=ll:goto470
  56. 550 pokell+54272,10:ifpeek(ll)=p%thenpokell,32
  57. 560 pokel+54272,7:ifpeek(l)=32thenpokel,p%
  58. 570 gosub1050
  59. 580 goto450
  60. 590 wait56464,16
  61. 600 ifsl=.andpeek(l)=p%then450
  62. 610 ifpeek(l)=42thensl=.:pokel,m%:goto450
  63. 620 ifsl=.thensl=l:pokel,42:goto450
  64. 630 ifabs(sl-l)<>p%andabs(sl-l)<>4then450
  65. 640 ifpeek(l)<>p%then450
  66. 650 t=(sl+l)/2
  67. 660 ifpeek(t)=32then450
  68. 670 pokesl,32:pokel,m%:poket,32
  69. 680 sl=.:c=.
  70. 690 fory=.to1:forx=.to2
  71. 700 t=bl+o%*y+2*x
  72. 710 ifpeek(t)=m%thenc=c+1:goto750
  73. 720 ifpeek(t+o%)=m%thenifpeek(t+p%)=m%theny=n%:x=n%:goto750
  74. 730 ifx=.thenifpeek(t+2)=m%thenifpeek(t+4)=m%theny=n%:x=n%:goto750
  75. 740 ifx=2thenifpeek(t-2)=m%thenifpeek(t-4)=m%theny=n%:x=n%
  76. 750 next:next
  77. 760 gosub1050
  78. 770 ifx>n%ory>n%then450
  79. 780 fory=.to2:forx=.to6
  80. 790 t=bl+o%*y+2*x+q%
  81. 800 ifpeek(t)=m%thenc=c+1:goto860
  82. 810 ifpeek(t+o%)=m%thenifpeek(t+p%)=m%theny=n%:x=n%:goto860
  83. 820 ifpeek(t-o%)=m%thenifpeek(t-p%)=m%theny=n%:x=n%:goto860
  84. 830 ifpeek(t+2)=m%thenifpeek(t+4)=m%theny=n%:x=n%:goto860
  85. 840 ifpeek(t-2)=m%thenifpeek(t-4)=m%theny=n%:x=n%
  86. 850 gosub1050
  87. 860 next:next
  88. 870 ifx>n%ory>n%then450
  89. 880 fory=.to1:forx=.to2
  90. 890 t=bl+o%*y+2*x+r%
  91. 900 ifpeek(t)=m%thenc=c+1:goto940
  92. 910 ifpeek(t-o%)=m%thenifpeek(t-p%)=m%theny=n%:x=n%:goto940
  93. 920 ifx=.thenifpeek(t+2)=m%thenifpeek(t+4)=m%theny=n%:x=n%:goto940
  94. 930 ifx=2thenifpeek(t-2)=m%thenifpeek(t-4)=m%theny=n%:x=n%
  95. 940 next:next
  96. 950 ifx>n%ory>n%then450
  97. 960 pokel+54272,10
  98. 970 ifc=1thena$=" you win!":b$=a$
  99. 980 ifc>1thena$=" try again":b$=str$(c)+" left!"
  100. 990 poke781,24:poke782,6:sys65520
  101. 1000 print"[154]"a$tab(23)b$;
  102. 1010 wait56464,16:wait56464,16,16
  103. 1020 poke782,7:sys65520
  104. 1030 print"                         ";
  105. 1040 wait56464,16:goto360
  106. 1050 pokes,240:pokes+1,15:pokes+6,1
  107. 1060 pokes+5,8:pokes+22,104:pokes+23,2
  108. 1070 pokes+24,79:pokes+4,129
  109. 1080 forz=1to20:next:return
  110.