home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Run Magazine ReRun: Strategy Games 1
/
rerun-strategygamesI.d64
/
stack
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
5KB
|
155 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] 54
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,"stack 64 by glenn w. zuch
22 print#d,"
24 [152]d,"run it right: c-64
26 print#d,"
28 [152]d,"stack is a game of logic based on the
30 print#d,"popular towers of hanoi. the object is
32 [152]d,"to move several bars from the left-hand
34 print#d,"pile to the right-hand pile, using a
36 [152]d,"center pile as an intermediary. try to
38 print#d,"complete the task in as few moves as
40 [152]d,"possible and you'll win.
42 print#d,"you may not place a bar on top of one
44 [152]d,"that is smaller, but such errors will
46 print#d,"not affect your final score. there's
48 [152]d,"more than one way to move the piles, so
50 print#d,"keep trying!
52 [152]d,"":[160]d
54 [153]"press any key to begin the program..."
56 [161] e$:[139] e$[178]"" [167] 56
58 [156]
60 [143]*****stack*****
62 [141]228
64 [134]g(10,4)
66 [129]b[178]1[164]5:[129]l[178]1[164]3:g(b,l)[178]0:[130]l:[130]b
68 [153]"how many bars do you want to move
70 print"(2,3,4 or 5)?
72 [133] x
74 d[178]0
76 [129]z[178]1[164]5:[139]z[178]x[167]78:[130]z
78 [151]53281,5:[153]"load
80 print" [146]
82 [153]" 3 wait
84 print" 5 [146]
86 [153]" 7 wait
88 print" 9 [146]
90 [153]" 11 wait
92 print"123[144]
94 n[178]5:b[178]11
96 [129]c[178]x[164]1[169][171]1
98 g(n,1)[178]b:b[178]b[171]2:n[178]n[171]1:[130]c:[141]186
100 [139]x[178]2[167]mm$[178]"9 & 11"
102 [139]x[178]3[167]mm$[178]"7,9 & 11"
104 [139]x[178]4[167]mm$[178]"5,7,9 & 11"
106 [139]x[178]5[167]mm$[178]"3,5,7,9 & 11"
108 [153]"stopyou will be moving bars ";mm$
110 [153]"":[133]"which bar do you want to move";b
112 [139]b[178]3[175]x[178][179]4[167]120
114 [139]b[178]5[175]x[178][179]3[167]120
116 [139]b[178]7[175]x[178][179]2[167]120
118 [139](b[171]3)[172](b[171]5)[172](b[171]7)[172](b[171]9)[172](b[171]11)[178]0[167]122
120 [153]"you may only use ";mm$;"":[153] [166]10)"enter again!":[137]110
122 [129]y[178]1[164]5:[129]r[178]1[164]3:[139]g(y,r)[178]b[167]126
124 [130]r:[130]y
126 [129]z[178]y[164]1[169][171]1
128 [139]g(z,r)[178]0[167]132
130 [139]g(z,r)[179]b[167]134
132 [130]z:[137]138
134 [153]"that bar is under another one. makeanother choice.":[153]"
136 goto110
138 input"place bar on which stack";l
140 if(l-1)*(l-2)*(l-3)=0then144
142 print"you must choose '1', '2' or '3'":goto138
144 fory=1to5:ifg(y,l)<>0then150
146 nexty
148 goto156
150 ifb<g(y,l)then156
152 print"you can't place a longer bar on top of asmaller one...try again!
154 [153]"":[137]110
156 [129]w[178]1[164]5:[129]c[178]1[164]3:[139]g(w,c)[178]b[167]160
158 [130]c:[130]w
160 [129]v[178]1[164]5:[139]g(v,l)[179][177]0[167]166
162 [130]v
164 v[178]5:[137]168
166 v[178]v[171]1
168 g(v,l)[178]g(w,c):g(w,c)[178]0:[141]186
170 d[178]d[170]1
172 [129]y[178]1[164]5:[129]r[178]1[164]2:[139]g(y,r)[179][177]0[167]110
174 [130]r:[130]y
176 [139]d[179][177]2[174]x[171]1[167]212
178 [141]286
180 [151]53281,13:[153]"loadstoptry againclose('y' or 'n')";:[133] a$
182 [139] a$[178]"n" [167] 206
184 [139]a$[178]"y" [167] 66
186 [129]j[178]1[164]5:p[178]7:[129]s[178]1[164]3
188 [139]g(j,s)[178]0[167]200
190 [153][163]p[171][181](g(j,s)[173]2));
192 [129]w[178]1[164]g(j,s)
194 [153]"open wait";
196 [130]w
198 [137]202
200 [153][163]p);" wait";
202 p[178]p[170]11
204 [130]s:[153]:[130]j:[142]
206 [151]53280,4:[151]53281,7:[153]"load
208 print"thank you...please play again soon.":fort=1to3000:next:print"[147]
210 [128]
212 [151]53280,0:[151]53281,8:[153]"load
214 ifx=2thenm$="3 moves"
216 ifx=3thenm$="7 moves"
218 ifx=4thenm$="15 moves"
220 ifx=5thenm$="31 moves"
222 print"it took you";d;"moves.
224 [153]"it could have been done in only ";m$;"
226 print"try harder next time!":fort=1to5000:next:goto180
228 poke53280,8:poke53281,3:print"[147]
230 [153]"
232 print"
234 [153]"
236 print"
238 [153]"
240 print"
242 [153]"
244 print"
246 [153]" ":[153]"":[129]t[178]1[164]1500:[130]
248 [153]"stop123
250 print" [146]
252 [153]" wait
254 print" [146]
256 [153]"sys stop3sys wait
258 print"[144] [144]5[144] [146]
260 [153]" stop7 wait
262 print" [144]9 [146]
264 [153]" stop11 wait":[129]t[178]1[164]3000:[130]
266 [151]53280,7:[151]53281,15:[153]"load
268 print"to play this game you must transfer the":print
270 print"bars from the left[146] stack to the right[146]":print
272 print"stack, one bar at a time, never putting":print
274 print"a longer bar on a smaller one.":print"
276 [153]"press <return>wait to continue
278 print"[155]":input c
280 poke53280,2:poke53281,7:print"[147][144]
282 [153]"you may choose from 2 to 5 bars":[153]
284 [153]"when you start the game.":[129]t[178]1 [164] 1500:[130]:[142]
286 [151]53280,7:[151]53281,14:[153]"load
288 print"xxxxxxxxxxxxxxxxxxxxxx
290 [153]"xxxxxxxxx
292 print"xxxxxxxx
294 [153]"xxxxxxxx
296 print"xxxxxxxxxxxxxxxxxxxxx
298 [153]"xxxxxxx
300 print"xxxxxxx
302 [153]"xxxxxxxx
304 print"xxxxxxxxxxxxxxxxx
306 [153]"you did it in the least possible
308 print"number of moves!!!!!":fort=1to2500:next:return