home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun: Strategy Games 1 / rerun-strategygamesI.d64 / boxes (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  4KB  |  124 lines

  1. 2 printchr$(147)"would you like instructions (y/n)?
  2. 4 [161] a$: [139] a$[179][177] "y" [175] a$[179][177]"n" [167] 4
  3. 6 [139] a$[178]"n" [167] 58
  4. 8 [153]"instructions on screen or printer (s/p)?
  5. 10 get b$: if b$<> "s" and b$<>"p" then 10
  6. 12 if b$="s"then  d=3
  7. 14 if b$="p" then d=4
  8. 16 open d,d
  9. 18 print#d,"
  10. 20 [152]d,"boxes by michael murtagh
  11. 22 print#d,"
  12. 24 [152]d,"run it right:  c-64; joystick
  13. 26 print#d,"
  14. 28 [152]d,"boxes is a two-player game that can be
  15. 30 print#d,"played with 1 (port 1) or 2 joysticks.
  16. 32 [152]d,"use the joystick to move the
  17. 34 print#d,"cursor (line) to an empty space between
  18. 36 [152]d,"adjacent stars.  press the firebutton
  19. 38 print#d,"to set the line into place.  pressing
  20. 40 [152]d,"the joystick diagonally switches the
  21. 42 print#d,"line from horizontal to vertical
  22. 44 [152]d,"position.
  23. 46 print#d,"if you complete a box, you win it and
  24. 48 [152]d,"you move again.  if you don't complete
  25. 50 print#d,"a box, control passes to your opponent.
  26. 52 [152]d,"whoever has the most boxes when the
  27. 54 print#d,"matrix is filled, wins!
  28. 56 [152]d,"":[160]d
  29. 58 [153]"press any key to begin the program..."
  30. 60 [161] e$:[139] e$[178]""[167] 60
  31. 62 [156]
  32. 64 [143] boxes
  33. 66 [134] xs(10),ys(10),zs(10,2),ld(11,11),fb(25)
  34. 68 [137]106
  35. 70 [143] **]sub **  joystick routine
  36. 72 fr[178]1:jv[178][194](jl):fr[178]jv[175]16:[139]fr[178]0[167]78
  37. 74 jv[178]mk[171]jv[175]mk:[139]jv[177]0[167]78
  38. 76 [137]72
  39. 78 [142]
  40. 80 [143] ** sub ** check if box filled
  41. 82 n[178]0:gb[178]0:[129]i[178]1[164]25:[139]fb(i)[177]0[167]n[178]n[170]1:[137]100
  42. 84 fl[178]0:vb[178][181]((i[171]1)[173]5)[170]1:hb[178]i[171]5[172](vb[171]1)
  43. 86 [139]ld(2[172]hb[171]1,2[172]vb)[178]1[167]fl[178]fl[170]1
  44. 88 [139]ld(2[172]hb,2[172]vb[171]1)[178]1[167]fl[178]fl[170]1
  45. 90 [139]ld(2[172]hb[170]1,2[172]vb)[178]1[167]fl[178]fl[170]1
  46. 92 [139]ld(2[172]hb,2[172]vb[170]1)[178]1[167]fl[178]fl[170]1
  47. 94 [139]fl[179]4[167]100
  48. 96 gb[178]1:fb(i)[178]p:n[178]n[170]1:a[178]48[170]p:b[178]c(p):xb[178]xo[170]80[172](vb[171]1)[170]4[172](hb[171]1)[170]42
  49. 98 [151]xb,a:[151]xb[170]dc,b
  50. 100 [130]
  51. 102 [142]
  52. 104 [143] initialize
  53. 106 [141]184:[141]218
  54. 108 [143] start game loop
  55. 110 [141]72:[139]fr[178]0[137]138
  56. 112 xt[178]xl[170]xs(jv):yt[178]yl[170]ys(jv):gm[178]0
  57. 114 [139]xt[179]0 [176] xt[177]20 [176] yt[179]0 [176] yt[177]10 [167]110
  58. 116 [139]ld(ho,vo)[178]0[167][151]bo,32:[151]bo[170]dc,1:[137]120
  59. 118 [151]bo,bs:[151]bo[170]dc,3
  60. 120 a[178]xs(jv):b[178]ys(jv)
  61. 122 [139]a[179][177]0[167]ho[178]ho[170]a[173]2
  62. 124 [139]b[179][177]0[167]vo[178]vo[170]b
  63. 126 xl[178]xt:yl[178]yt:bb[178]xo[170]40[172]yl[170]xl:bs[178]zs(jv,bl):[151]bb,bs:[151]bb[170]dc,12:bo[178]bb
  64. 128 [129]i[178]0[164]3:a[178]2[174]i:[139]a[178]jv[167][137]134
  65. 130 [130]
  66. 132 bl[178]bl[170]1:[139]bl[177]2[167]bl[178]1
  67. 134 [137]110
  68. 136 [143] draw line and check if boxes filled
  69. 138 [139]ld(ho,vo)[178]1[167]110
  70. 140 b[178]bo:ii[178]0:[139]bl[178]1[167]ii[178]2:b[178]bo[171]1
  71. 142 [129]i[178]0[164]ii:[151]b[170]i,bs:[151]b[170]i[170]dc,3:[130]
  72. 144 ld(ho,vo)[178]1:
  73. 146 [141]82:[139]n[178]25[137]158
  74. 148 [151]bo,bs:[151]bo[170]dc,12
  75. 150 [139]gb[178]1[167]110
  76. 152 p[178]p[170]1:[139]p[177]2[167]p[178]1
  77. 154 jl[178]nj(p):[153]h$m$c$(p)n$(p)bb$:[137]110
  78. 156 [143] ** game won ** find the winner
  79. 158 [129]i[178]1[164]2:bt(i)[178]0:[130]
  80. 160 [129]i[178]1[164]25:j[178]fb(i):bt(j)[178]bt(j)[170]1:[130]
  81. 162 [153][199](147)d2$d2$
  82. 164 [129] i[178]1[164]2:[153]a5$c$(i)bt(i)a5$n$(i):[153]:[130]
  83. 166 j[178]1:[139]bt(2)[177]bt(1)[167]j[178]2
  84. 168 [153]d2$a5$c$(j)"the winner is "n$(j)
  85. 170 ng(j)[178]ng(j)[170]1
  86. 172 [153]d2$a5$"play again (y/n)?"
  87. 174 [161]yn$:[139]yn$[178]""[167]174
  88. 176 [139]yn$[178]"y"[167][141]218:[137]110
  89. 178 [139]yn$[179][177]"n"[167]174
  90. 180 [144]
  91. 182 [143] ** sub ** setup initial game
  92. 184 [153][199](147):[151]53280,3:[151]53281,1:dc[178]55296[171]1024:mk[178]15
  93. 186 d1$[178][199](17):d2$[178]d1$[170]d1$:a1$[178][199](29):a2$[178]a1$[170]a1$:a5$[178]a1$
  94. 188 [129] i[178]1[164]4:a5$[178]a5$[170]a1$:[130]:c(1)[178]14:c(2)[178]4:c$(1)[178][199](154):c$(2)[178][199](156)
  95. 190 h$[178][199](19)[170]d2$[170]d2$[170]d2$[170]a5$[170][199](13):b$[178][199](32):bb$[178]b$
  96. 192 [129]i[178]1[164]9:bb$[178]bb$[170]b$:[130]:m$[178][199](150)[170]"   your turn ":mm$[178]"boxes"
  97. 194 [129]j[178]1[164]4:[129]i[178]1[164]2:[153]d1$c$(i)mm$;:[130]:[130]:[153]d1$[199](150)
  98. 196 [129]i[178]1[164]2:ng(i)[178]0
  99. 198 [153]"name of player #"i;:[133]n$(i):[130]
  100. 200 [153]:[133]"number of joysticks ";n
  101. 202 nj(1)[178]56321:nj(2)[178]nj(1):[139]n[178]2[167]nj(2)[178]56320
  102. 204 [129]i[178]1[164]10:[135]a,b:xs(i)[178]a:ys(i)[178]b:[130]
  103. 206 [129]i[178]1[164]2:[129]j[178]1[164]10:[135]a:zs(j,i)[178]a:[130]:[130]
  104. 208 [131]0,-2,0,2,0,0,-4,0,-2,-1,-2,1,0,0,4,0,2,-1,2,1
  105. 210 [131]67,67,0,67,66,66,0,67,66,66
  106. 212 [131]66,66,0,66,67,67,0,66,67,67
  107. 214 [142]
  108. 216 [143] ** sub ** draw boxes for new game
  109. 218 [153][199](147)d1$
  110. 220 [153][199](159)a5$a2$"player"a2$"games"a2$"name"[199](150)
  111. 222 [129]i[178]1[164]2:vv[178]48[170]ng(i):v[178]48[170]i
  112. 224 q$(i)[178]c$(i)[170]a5$[170][199](v)[170]a5$[170][199](vv)[170]a5$[170]n$(i):[130]
  113. 226 [153]:[129]i[178]1[164]2:nb(i)[178]0:[153]a5$q$(i):[130]:[153][199](154)
  114. 228 xo[178]1430:s[178]42:sc[178]5
  115. 230 [129] i[178]1[164]12[169]2
  116. 232 yo[178]xo[170]40[172](i[171]1)
  117. 234 [129]j[178]1[164]24[169]4
  118. 236 xy[178]yo[170]j[171]1:[151]xy,s:[151]dc[170]xy,sc:[130]:[130]
  119. 238 [129]i[178]1[164]25:fb(i)[178]0:[130]:[129]i[178]1[164]11:[129]j[178]1[164]11:ld(i,j)[178]0:[130]:[130]
  120. 240 jl[178]nj(1):xl[178]2:yl[178]0:jv[178]1:ho[178]2:vo[178]1:p[178]p[170]1:[139]p[177]2[167]p[178]1
  121. 242 bb[178]xo[170]2:bs[178]zs(1,1):[151]bb,bs:[151]bb[170]dc,12:bo[178]bb:bl[178]1
  122. 244 [153]h$m$c$(p)n$(p)bb$
  123. 246 [142]
  124.