home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / logo / labybug / basket.bug < prev    next >
Text File  |  1989-11-09  |  4KB  |  202 lines

  1. to "poly   :d :a
  2. forward :d
  3. right :a
  4. poly :d :a
  5. end
  6.  
  7. to "and  :a :b
  8. if :a = "true [output :b = "true]
  9. output "false
  10. end
  11.  
  12. to "or  :a :b
  13. if :a = "true [output "true]
  14. output :b = "true
  15. end
  16.  
  17. to "while  :condition :list
  18. if ( run :condition ) = "false then stop
  19. run :list
  20. while :condition :list
  21. end
  22.  
  23. to "forever  :list
  24. repeat 32000 :list
  25. forever :list
  26. end
  27.  
  28. to "xor  :a :b
  29. if :a = "true [output :b = "false]
  30. output :b = "true
  31. end
  32.  
  33. to "wait  :seconds
  34. tone 32000  20 * :seconds
  35. tone 32000 1  ;above times the wait; this makes us wait
  36. end
  37.  
  38. to "max  :a :b
  39. if :a > :b [output :a]
  40. output :b
  41. end
  42.  
  43. to "min  :a :b
  44. if :a > :b [output :b]
  45. output :a
  46. end
  47.  
  48. to "teams   
  49. print [Enter Home Team Nickname]
  50. make "ht request
  51. print [Enter Visiting Team Nickname]
  52. make "vt request
  53. score :hs :vs :ht :vt
  54. make "p 0
  55. jump :p
  56. end
  57.  
  58. to "start   
  59. make "hs 0
  60. make "vs 0
  61. make "t 0
  62. make "Q 1
  63. teams
  64. end
  65.  
  66. to "foul   
  67. make "x integer random 6
  68. if :x = 0 [print [Three point play!] 3pt :p stop]
  69. if or ( :x = 1 ) ( :x = 2 ) [print [Two shots made] 2pt :p stop]
  70. if or ( :x = 3 ) ( :x = 4 ) [print [One shot made] 1pt :p stop]
  71. if :x = 5 [print [Missed foul shot] rebound stop]
  72. end
  73.  
  74. to "2pt   :P
  75. if :P = 0 [make "vs :vs + 2 score :hs :vs :ht :vt turnover :p stop]
  76. make "hs :hs + 2
  77. score :hs :vs :ht :vt
  78. turnover :p
  79. stop
  80. end
  81.  
  82. to "jump   :P
  83. make "x integer random 3
  84. if :x = 0 [make "P 1 turnover :p stop]
  85. make "P 0
  86. turnover :p
  87. stop
  88. end
  89.  
  90. to "center   
  91. make "x integer random 14
  92. if :x = 0 [print [Basket scored!] 2pt :p stop]
  93. if :x = 1 [print [Foul] foul stop]
  94. if and :x > 1  :x < 4  [print [Lose ball] turnover :p]
  95. fwd
  96. end
  97.  
  98. to "print2   
  99. print []
  100. print []
  101. end
  102.  
  103. to "final   
  104. print [Game Over]
  105. score :hs :vs :ht :vt
  106. end
  107.  
  108. to "fwd   
  109. make "x random 11
  110. if :x < 4 [print [Basket scored!] 2pt :p stop]
  111. if and :x > 3  :x < 6  [print [Shot missed] rebound stop]
  112. if and  :x > 5  :x < 8  [print [Lose ball!] turnover :p stop]
  113. if and  :x > 7  :x < 10  [print [Foul] foul :p stop]
  114. if :x = 10 [print [Forward dribbles - Pass again] timer :t :q stop]
  115. end
  116.  
  117. to "timer   :t :q
  118. make "t ( :t + 1 )
  119. if :T < 7 [pass stop]
  120. if :Q = 4 [final stop]
  121. ( print [End of quarter] :Q )
  122. make "t 0
  123. make "q :q + 1
  124. score :hs :vs :ht :vt
  125. print [Jump ball starts quarter.]
  126. jump :p
  127. stop
  128. end
  129.  
  130. to "guard   
  131. make "x random 14
  132. if :x < 3 [print [Guard dribbles - pass again] timer :t :q stop]
  133. fwd
  134. end
  135.  
  136. to "pass   
  137. print2
  138. print [C - Pass to Center]
  139. print [G - Pass to Guard]
  140. print [F - Pass to Forward]
  141. print2
  142. print [Choose - C G F]
  143. print2
  144. make "x request
  145. if :x = "c then center stop
  146. if :x = "g then guard stop
  147. if :x = "f then fwd stop
  148. print [Type C G or F] pass
  149. end
  150.  
  151. to "3pt   :p
  152. if :p = 0 [make "vs :vs + 3 score :hs :vs :ht :vt turnover :p stop]
  153. make "hs :hs + 3 turnover :p score :hs :vs :ht :vt stop
  154. end
  155.  
  156. to "score   :hs :vs :ht :vt
  157. print2
  158. print se :ht :hs
  159. print se :vt :vs
  160. print2
  161. end
  162.  
  163. to "1pt   :P
  164. if :p = 0 [make "vs :vs + 1 score :hs :vs :ht :vt fsreb stop]
  165. make "hs :hs + 1
  166. score :hs :vs :ht :vt
  167. fsreb
  168. stop
  169. end
  170.  
  171. to "turnover   :P
  172. if :P = 0 [print :ht print [Ball] make "p 1 pass stop]
  173. print :vt
  174. print [Ball]
  175. make "P 0
  176. PASS
  177. stop
  178. end
  179.  
  180. to "rebound   
  181. make "x random 3
  182. if :x < 2 [print [Rebound to defense] turnover :p stop]
  183. print [offense reboundS]
  184. pass
  185. stop
  186. end
  187.  
  188. to "fsreb   
  189. make "x random 2
  190. if :x = 0 [print [Second shot missed] rebound stop]
  191. turnover :p
  192. end
  193.  
  194. make "hs "'0
  195. make "vs "'0
  196. make "t "'0
  197. make "q "'1
  198. make "ht "'Jims
  199. make "vt "'Joes
  200. make "p "'0
  201. make "x "'6
  202. r :p