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