home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 4 / 004.d81 / spiders (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1984-01-01  |  7.9 KB  |  207 lines

  1. 1 rem ---------------------------------       grade 12 computer science project
  2. 2 rem  spiders         by ian phillips
  3. 3 rem ---------------------------------
  4. 4 rem                                     :
  5. 5 gosub6000
  6. 6 rem                                         ---------------------------------
  7. 7 rem      redefining characters              ---------------------------------
  8. 8 rem                                     :
  9. 10 poke53272,(peek(53272)and240)+12:poke52,48:poke56,48:clr
  10. 20 poke56334,peek(56334)and254:poke1,peek(1)and251:fori=0to511
  11. 30 pokei+12288,peek(i+53248):next:poke1,peek(1)or4:poke56334,peek(56334)or1
  12. 40 :    fori=13128to13135:reada:pokei,a:next
  13. 50 :    fori=13040to13047:reada:pokei,a:next
  14. 60 :    fori=13304to13311:reada:pokei,a:next
  15. 70 :    fori=12536to12543:reada:pokei,a:next
  16. 71 :    fori=13104to13111:reada:pokei,a:next
  17. 72 :    fori=13008to13015:reada:pokei,a:next
  18. 73 :    fori=13048to13055:reada:pokei,a:next
  19. 74 :    fori=12936to12943:reada:pokei,a:next
  20. 78 :
  21. 80 data 153,219,126,60,231,60,102,219,24,189,66,126,255,231,231,195,24,126,255
  22. 81 data 0,255,255,255,255,60,102,231,231,102,60,24,60,255,255,255,255,255,255
  23. 82 data 255,255,0,0,0,120,120,0,0,0,126,199,254,220,140,134,195,126,28,62,255
  24. 83 data 255,126,62,28,8
  25. 85 print"[145]                          "
  26. 86 print"[145]     press return to play "
  27. 87 getg$:ifg$<>chr$(13)then85
  28. 88 rem                                         --------------------------------
  29. 89 rem    set up game, counters etc...         --------------------------------
  30. 90 rem                                     :
  31. 91 c=5:poke53281,0:poke53280,11:forl=54272to54296:pokel,0:next:poke54296,15
  32. 92 poke54271,128:poke54284,64:poke54291,128:poke54278,128:poke54285,248
  33. 93 tv=8:tw=8:b=0:cf=0:print"[147]":poke54292,64:sc=0
  34. 100 rem                                         -------------------------------
  35. 101 rem    game board set up                    -------------------------------
  36. 102 rem                                     :
  37. 105 print"[129] [166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166]
  38. 106 [153]" spc((NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)spc((NULL)(NULL)(NULL)(NULL)spc((NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)spc(
  39. 107 print" [166][218][166][166][166][166][166][166][218][166][166][166][166][166][166][218][166][218][166][166][218][166][218][166][166][166][166][166][166][218][166][166][166][166][166][166][218][166]
  40. 108 [153]" spc((NULL)spc((NULL)(NULL)(NULL)(NULL)spc((NULL)(NULL)(NULL)spc(spc((NULL)(NULL)(NULL)spc((NULL)spc(spc((NULL)spc((NULL)(NULL)(NULL)spc(spc((NULL)(NULL)(NULL)spc((NULL)(NULL)(NULL)(NULL)spc((NULL)spc(
  41. 109 print" [166][218][218][218][166][166][218][166][218][166][218][166][166][218][166][218][166][218][166][166][218][166][218][166][218][166][166][218][166][218][166][218][166][166][218][218][218][166]
  42. 110 [153]" spc((NULL)spc((NULL)spc(spc((NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)spc((NULL)spc((NULL)spc(spc((NULL)spc((NULL)spc((NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)spc(spc((NULL)spc((NULL)spc(
  43. 111 print" [166][218][166][218][166][166][218][166][218][166][166][166][166][166][166][218][166][218][166][166][218][166][218][166][166][166][166][166][166][218][166][218][166][166][218][166][218][166]
  44. 112 [153]" spc((NULL)spc((NULL)(NULL)(NULL)(NULL)spc((NULL)spc((NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)spc((NULL)spc((NULL)(NULL)(NULL)(NULL)spc((NULL)spc(
  45. 113 print" [166][218][166][166][218][166][166][166][218][166][218][166][166][218][166][218][166][218][166][166][218][166][218][166][218][166][166][218][166][218][166][166][166][218][166][166][218][166]
  46. 114 [153]" spc((NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)spc((NULL)spc(spc((NULL)spc((NULL)spc((NULL)spc(spc((NULL)spc((NULL)spc((NULL)spc(spc((NULL)spc((NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)spc(
  47. 115 print" [166][218][166][166][166][166][166][166][218][166][218][166][166][218][166][218][166][218][166][166][218][166][218][166][218][166][166][218][166][218][166][166][166][166][166][166][218][166][166]";
  48. 116 print"[166][166][218][166][218][218][218][218][166][218][166][218][218][218][218][166][218][166][218][218][218][218][166][218][166][218][218][218][218][166][218][166][218][218][218][218][166][218][218][218]";
  49. 117 print"[218][218][218][166][218][166][166][218][218][218][218][218][166][166][218][218][218][166][218][166][166][218][166][218][218][218][166][166][218][218][218][218][218][166][166][218][166][218][166][166]";
  50. 118 print"[166][166][218][166][218][166][166][218][166][218][166][218][218][218][218][166][218][218][218][166][166][218][218][218][166][218][218][218][218][166][218][166][218][166][166][218][166][218][166]
  51. 119 [153]" spc((NULL)spc((NULL)spc(spc((NULL)spc((NULL)spc(spc(spc(spc(spc(spc((NULL)spc((NULL)(NULL)(NULL)(NULL)spc((NULL)spc(spc(spc(spc(spc(spc((NULL)spc((NULL)spc(spc((NULL)spc((NULL)spc(
  52. 120 print" [166][218][218][218][166][166][218][218][218][166][218][218][218][218][166][218][166][166][166][166][166][166][218][166][218][218][218][218][166][218][218][218][166][166][218][218][218][166]
  53. 121 [153]" spc((NULL)spc((NULL)spc(spc((NULL)spc((NULL)spc((NULL)spc(spc((NULL)spc((NULL)spc((NULL)(NULL)(NULL)(NULL)spc((NULL)spc((NULL)spc(spc((NULL)spc((NULL)spc((NULL)spc(spc((NULL)spc((NULL)spc(
  54. 122 print" [166][218][166][218][166][166][218][166][218][166][218][166][166][218][166][218][166][218][166][166][218][166][218][166][218][166][166][218][166][218][166][218][166][166][218][166][218][166]
  55. 123 [153]" spc((NULL)spc((NULL)spc(spc((NULL)spc((NULL)(NULL)(NULL)spc(spc((NULL)(NULL)(NULL)spc((NULL)spc(spc((NULL)spc((NULL)(NULL)(NULL)spc(spc((NULL)(NULL)(NULL)spc((NULL)spc(spc((NULL)spc((NULL)spc(
  56. 124 print" [166][218][166][218][218][218][218][166][218][166][218][166][166][218][166][218][166][218][218][218][218][166][218][166][218][166][166][218][166][218][166][218][218][218][218][166][218][166]
  57. 125 [153]" spc((NULL)spc(spc(spc(spc((NULL)spc((NULL)spc((NULL)spc(spc((NULL)(NULL)(NULL)(NULL)(NULL)spc(spc((NULL)(NULL)(NULL)(NULL)(NULL)spc(spc((NULL)spc((NULL)spc((NULL)spc(spc(spc(spc((NULL)spc(
  58. 126 print" [166][218][218][218][218][218][218][218][218][218][218][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][218][218][218][218][218][218][218][218][218][218][166]
  59. 127 [153]" spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(spc(
  60. 128 :
  61. 130 rem **** place game characters ****     :
  62. 135 ifc>30thenc=30
  63. 140 :    forl=1to(2*c)
  64. 150 x=int(1000*rnd(1))+1024:ifpeek(x)<>90then150
  65. 160 pokex,127:pokex+54272,7:next:forl=1toc
  66. 170 x=int(1000*rnd(1))+1024:ifpeek(x)<>90then170
  67. 180 pokex,31:pokex+54272,4:next:forl=1toc
  68. 190 fly=int(1000*rnd(1))+1024:ifpeek(fly)=90thenpokefly,94:pokefly+54272,1
  69. 195 ifpeek(fly)<>94thengoto190
  70. 200 spi=int(1000*rnd(1))+1024:ifpeek(spi)=90thenpokespi,105:pokespi+54272,1
  71. 205 ho=spi:ifpeek(spi)<>105thengoto200
  72. 210 mc=int(1000*rnd(1))+1024:ifpeek(mc)<>90then210
  73. 220 pokemc,127:pokemc+54272,7
  74. 240 :
  75. 250 rem ******* set timer *************     :
  76. 260 me=ti
  77. 290 :
  78. 500 rem                                         -------------------------------
  79. 501 rem    movement of spider                   -------------------------------
  80. 502 rem                                     :
  81. 505 ifcf=1thenfly=spi
  82. 506 pokeho+54272,1:pokeho,8:poke54272+fly,1
  83. 510 getg$:poke56322,0:j=peek(56320):t=jand16:j=15-(jand15):poke56322,255
  84. 511 ifcm=3thengosub1000
  85. 512 ifcf<>0thenff=0:goto514
  86. 513 ifff=40thengosub1000
  87. 514 ff=ff+1:cm=cm+1:ifcf=1thensc=sc-1
  88. 515 ifg$=" "then7000
  89. 516 print"score:"sc"[157] [166][166][166][166][166][166][166]"
  90. 520 ifj=1thenmove=-40:goto530
  91. 521 ifj=2thenmove=+40:goto530
  92. 522 ifj=4thenmove=-1:goto530
  93. 523 ifj=8thenmove=+1:goto530
  94. 524 ift=16thenpokeho+54272,0:pokefly+54272,0:goto505
  95. 525 goto580
  96. 530 ifpeek((spi+move))=8then5000
  97. 531 ifpeek((spi+move))<>90then600
  98. 540 pokespi,90:pokespi+54272,0:spi=spi+move:pokespi,105:pokespi+54272,1:sc=sc+1
  99. 550 goto510
  100. 560 :
  101. 580 ifpeek(spi+move)=127then582
  102. 581 ifpeek(spi+move)<>31then510
  103. 582 :   forl=1to100step10:pokespi+move,109:pokespi+move,123:sc=sc+5:poke54273,l
  104. 583 poke54272,l+10:poke54276,129:next:poke54276,0:pokespi,90:pokespi+54272,0
  105. 584 spi=spi+move:pokespi,105:pokespi+54272,1:goto510
  106. 590 :
  107. 600 rem                                         -------------------------------
  108. 601 rem    check obstructions                   -------------------------------
  109. 602 rem                                     :
  110. 610 ifpeek(spi+move)<>127then630
  111. 615 :    forl=50to250step5:pokespi,95:poke54273,l:poke54272,l+5:poke54276,129
  112. 620 pokespi+54272,1:pokespi,81:next:poke54276,0
  113. 625 goto7000
  114. 629 :
  115. 630 ifpeek(spi+move)<>31then650
  116. 635 :    forl=1to3:poke54273,255:poke54272,254:poke54276,17:poke54280,12
  117. 640 poke54279,10:poke54283,33:pokespi+54272,l:next:poke54276,0:poke54283,0
  118. 645 goto7000
  119. 649 :
  120. 650 ifpeek(spi+move)<>94then699
  121. 655 cf=1:forn=10to100step10:poke54273,n:poke54272,n-1:poke54276,17:next
  122. 656 sc=sc+1000
  123. 660 pokespi,90:pokespi+54272,0:spi=spi+move:pokespi,105:poke54276,0:goto510
  124. 698 :
  125. 699 goto510
  126. 1000 rem                                         ------------------------------
  127. 1001 rem   relocate fly and spray cans           ------------------------------
  128. 1002 rem                                     :
  129. 1010 ifcm<>3then1400
  130. 1011 pokemc,90:pokemc+54272,tv
  131. 1012 mc=int(1000*rnd(1))+1024:ifpeek(mc)<>90then1012
  132. 1013 tv=peek(mc+54272):pokemc,127:pokemc+54272,7:cm=0
  133. 1400 ifcf=1then4000
  134. 1410 :
  135. 1500 ifff<>40then4000
  136. 1510 pokefly,90:pokefly+54272,tw
  137. 1512 fly=int(1000*rnd(1))+1024:ifpeek(fly)<>90then1512
  138. 1513 tw=peek(fly+54272):pokefly,94:pokefly+54272,1:ff=0
  139. 4000 return
  140. 5000 rem                                         ------------------------------
  141. 5001 rem   spider back at home bace              ------------------------------
  142. 5002 rem                                     :
  143. 5003 rem **** is fly with spider ? ****      :
  144. 5010 ifcf=0then540
  145. 5011 me=ti-me:ifme<10000thenb=b+5
  146. 5015 sc=sc+1000
  147. 5016 :    forn=100to10step-10:poke54273,n:poke54272,n-1:poke54276,17
  148. 5020 poke53280,1:poke53280,251:poke53281,1:poke53281,240:next:c=c+5:cf=0
  149. 5030 poke54276,0:goto100
  150. 5060 :
  151. 6000 rem                                         ------------------------------
  152. 6001 rem   instructions                          ------------------------------
  153. 6002 rem                                     :
  154. 6010 poke53281,1:poke53280,1
  155. 6020 print"[147][144][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166]";
  156. 6030 forl=1to20:print"[166]                                      [166]";:next
  157. 6040 print"[166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166]"
  158. 6050 print""
  159. 6060 print"     spiders - instructions
  160. 6062 [153]"start at the 'h' and catch the fly((NULL))."
  161. 6063 [153]"watch out for raid (sin) & for bugs (_)."
  162. 6064 [153]"eliminate them with fire button."
  163. 6065 [153]"use control port #2 for your joystick."
  164. 6066 [153]"space bar ends game automatically."
  165. 6067 [153]"any number of rounds can be played."
  166. 6068 [153]"a new round starts when fly is brought"
  167. 6069 [153]"home-'h'. game ends if sprayed or "
  168. 6070 [153]"caught by bug. the faster the better!"
  169. 6075 [153]"   re-defining characters"
  170. 6080 :
  171. 6999 [142]
  172. 7000 [143]                                         ------------------------------
  173. 7001 [143]   end of game                           ------------------------------
  174. 7002 [143]                                     :
  175. 7010 [153]"load"
  176. 7400 :   [129]l[178]1[164]b:sc[178]sc[170]217:[153]"score:"sc:[129]g[178]1[164]50:[130]g,l
  177. 7425 [139]sc[177]hs[167]hs[178]sc:hs[178]hs[171]217
  178. 7426 sc[178]sc[171]217:[153]"score:"sc"cmd    "
  179. 7450 [153]"high score:"hs
  180. 7500 [153]"play again? (y/n)"
  181. 7510 [161]g$:[139]g$[178]"y"[167]90
  182. 7520 [139]g$[179][177]"n"[167]7510
  183. 7530 [153]"loadstop":[151]53280,1:[151]53281,1:[137]63000:[128] [175] hook back [164] pay[147]
  184. 8000 [143]                                         ------------------------------
  185. 8001 [143]      dictionary                         ------------------------------
  186. 8002 :
  187. 8010 [143]   c = number of obstructions
  188. 8011 [143] fly = fly's location
  189. 8012 [143] spi = spiders's location
  190. 8013 [143]  ho = spiders's home
  191. 8014 [143]  cf = indicates weather or not
  192. 8015 [143]       the spider has the fly
  193. 8016 [143]  mc = location of moving can
  194. 8017 [143]  cm = counter for moving can
  195. 8018 [143]  ff = counter for moving fly
  196. 8019 [143]  sc = score
  197. 8020 [143]  hs = high score
  198. 8021 [143]   x = random numbers
  199. 8022 [143]   j = joystick control
  200. 8023 [143]   t = joystick control
  201. 8024 [143]  me = timer
  202. 8025 [143]   b = bonus score (for speed)
  203. 8026 [143]                                         ------------------------------
  204. 63000 [140]:[151]53272,21:[151]56,160
  205. 63005 [153]"loadload"[199](34)"payload"[199](34)",8":[153]"run"
  206. 63010 [151]631,13:[151]632,13:[151]198,2:[128]
  207.