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