Logo Bolo: a re-envisioning of the classic tank game by Stuart Cheshire in NetLogo
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

551 lignes
11 KiB

  1. ;; lobo: Logo Bolo
  2. ;; (c) Ben Kurtovic, 2011
  3. ;;
  4. ;; Logo Bolo is a rewrite of the classic tank game by Stuart Cheshire in NetLogo.
  5. ;;
  6. globals [
  7. max-tank-speed
  8. player
  9. player-turn-speed
  10. ]
  11. breed [tanks tank]
  12. tanks-own [
  13. speed
  14. ]
  15. to setup
  16. ca
  17. set max-tank-speed 20
  18. set player-turn-speed 10
  19. create-tanks 1 [
  20. set player who
  21. set size 2
  22. set speed 0
  23. ]
  24. end
  25. to go
  26. end
  27. to go-forward
  28. ask tank player [
  29. if speed < max-tank-speed [
  30. set speed speed + 1
  31. ]
  32. ]
  33. end
  34. to slow-down
  35. ask tank player [
  36. if speed > 0 [
  37. set speed speed - 1
  38. ]
  39. ]
  40. end
  41. to turn-left
  42. ask tank player [
  43. lt player-turn-speed
  44. ]
  45. end
  46. to turn-right
  47. ask tank player [
  48. rt player-turn-speed
  49. ]
  50. end
  51. @#$#@#$#@
  52. GRAPHICS-WINDOW
  53. 475
  54. 10
  55. 912
  56. 468
  57. 16
  58. 16
  59. 12.94
  60. 1
  61. 10
  62. 1
  63. 1
  64. 1
  65. 0
  66. 1
  67. 1
  68. 1
  69. -16
  70. 16
  71. -16
  72. 16
  73. 0
  74. 0
  75. 1
  76. ticks
  77. BUTTON
  78. 85
  79. 91
  80. 159
  81. 124
  82. Setup
  83. setup
  84. NIL
  85. 1
  86. T
  87. OBSERVER
  88. NIL
  89. R
  90. NIL
  91. NIL
  92. BUTTON
  93. 89
  94. 151
  95. 152
  96. 184
  97. Go
  98. go
  99. T
  100. 1
  101. T
  102. OBSERVER
  103. NIL
  104. G
  105. NIL
  106. NIL
  107. BUTTON
  108. 270
  109. 216
  110. 359
  111. 249
  112. Forward
  113. go-forward
  114. NIL
  115. 1
  116. T
  117. OBSERVER
  118. NIL
  119. W
  120. NIL
  121. NIL
  122. BUTTON
  123. 220
  124. 278
  125. 283
  126. 311
  127. Left
  128. turn-left
  129. NIL
  130. 1
  131. T
  132. OBSERVER
  133. NIL
  134. A
  135. NIL
  136. NIL
  137. BUTTON
  138. 327
  139. 277
  140. 396
  141. 310
  142. Right
  143. turn-right
  144. NIL
  145. 1
  146. T
  147. OBSERVER
  148. NIL
  149. D
  150. NIL
  151. NIL
  152. BUTTON
  153. 256
  154. 337
  155. 364
  156. 370
  157. Slow Down
  158. slow-down
  159. NIL
  160. 1
  161. T
  162. OBSERVER
  163. NIL
  164. S
  165. NIL
  166. NIL
  167. MONITOR
  168. 52
  169. 303
  170. 152
  171. 348
  172. Player Speed
  173. [speed] of tank player
  174. 17
  175. 1
  176. 11
  177. @#$#@#$#@
  178. WHAT IS IT?
  179. -----------
  180. This section could give a general understanding of what the model is trying to show or explain.
  181. HOW IT WORKS
  182. ------------
  183. This section could explain what rules the agents use to create the overall behavior of the model.
  184. HOW TO USE IT
  185. -------------
  186. This section could explain how to use the model, including a description of each of the items in the interface tab.
  187. THINGS TO NOTICE
  188. ----------------
  189. This section could give some ideas of things for the user to notice while running the model.
  190. THINGS TO TRY
  191. -------------
  192. This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
  193. EXTENDING THE MODEL
  194. -------------------
  195. This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
  196. NETLOGO FEATURES
  197. ----------------
  198. This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.
  199. RELATED MODELS
  200. --------------
  201. This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
  202. CREDITS AND REFERENCES
  203. ----------------------
  204. This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
  205. @#$#@#$#@
  206. default
  207. true
  208. 0
  209. Polygon -7500403 true true 150 5 40 250 150 205 260 250
  210. airplane
  211. true
  212. 0
  213. Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
  214. arrow
  215. true
  216. 0
  217. Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
  218. box
  219. false
  220. 0
  221. Polygon -7500403 true true 150 285 285 225 285 75 150 135
  222. Polygon -7500403 true true 150 135 15 75 150 15 285 75
  223. Polygon -7500403 true true 15 75 15 225 150 285 150 135
  224. Line -16777216 false 150 285 150 135
  225. Line -16777216 false 150 135 15 75
  226. Line -16777216 false 150 135 285 75
  227. bug
  228. true
  229. 0
  230. Circle -7500403 true true 96 182 108
  231. Circle -7500403 true true 110 127 80
  232. Circle -7500403 true true 110 75 80
  233. Line -7500403 true 150 100 80 30
  234. Line -7500403 true 150 100 220 30
  235. butterfly
  236. true
  237. 0
  238. Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
  239. Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
  240. Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
  241. Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
  242. Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
  243. Circle -16777216 true false 135 90 30
  244. Line -16777216 false 150 105 195 60
  245. Line -16777216 false 150 105 105 60
  246. car
  247. false
  248. 0
  249. Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
  250. Circle -16777216 true false 180 180 90
  251. Circle -16777216 true false 30 180 90
  252. Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
  253. Circle -7500403 true true 47 195 58
  254. Circle -7500403 true true 195 195 58
  255. circle
  256. false
  257. 0
  258. Circle -7500403 true true 0 0 300
  259. circle 2
  260. false
  261. 0
  262. Circle -7500403 true true 0 0 300
  263. Circle -16777216 true false 30 30 240
  264. cow
  265. false
  266. 0
  267. Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
  268. Polygon -7500403 true true 73 210 86 251 62 249 48 208
  269. Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
  270. cylinder
  271. false
  272. 0
  273. Circle -7500403 true true 0 0 300
  274. dot
  275. false
  276. 0
  277. Circle -7500403 true true 90 90 120
  278. face happy
  279. false
  280. 0
  281. Circle -7500403 true true 8 8 285
  282. Circle -16777216 true false 60 75 60
  283. Circle -16777216 true false 180 75 60
  284. Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
  285. face neutral
  286. false
  287. 0
  288. Circle -7500403 true true 8 7 285
  289. Circle -16777216 true false 60 75 60
  290. Circle -16777216 true false 180 75 60
  291. Rectangle -16777216 true false 60 195 240 225
  292. face sad
  293. false
  294. 0
  295. Circle -7500403 true true 8 8 285
  296. Circle -16777216 true false 60 75 60
  297. Circle -16777216 true false 180 75 60
  298. Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
  299. fish
  300. false
  301. 0
  302. Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
  303. Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
  304. Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
  305. Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
  306. Circle -16777216 true false 215 106 30
  307. flag
  308. false
  309. 0
  310. Rectangle -7500403 true true 60 15 75 300
  311. Polygon -7500403 true true 90 150 270 90 90 30
  312. Line -7500403 true 75 135 90 135
  313. Line -7500403 true 75 45 90 45
  314. flower
  315. false
  316. 0
  317. Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
  318. Circle -7500403 true true 85 132 38
  319. Circle -7500403 true true 130 147 38
  320. Circle -7500403 true true 192 85 38
  321. Circle -7500403 true true 85 40 38
  322. Circle -7500403 true true 177 40 38
  323. Circle -7500403 true true 177 132 38
  324. Circle -7500403 true true 70 85 38
  325. Circle -7500403 true true 130 25 38
  326. Circle -7500403 true true 96 51 108
  327. Circle -16777216 true false 113 68 74
  328. Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
  329. Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
  330. house
  331. false
  332. 0
  333. Rectangle -7500403 true true 45 120 255 285
  334. Rectangle -16777216 true false 120 210 180 285
  335. Polygon -7500403 true true 15 120 150 15 285 120
  336. Line -16777216 false 30 120 270 120
  337. leaf
  338. false
  339. 0
  340. Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
  341. Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
  342. line
  343. true
  344. 0
  345. Line -7500403 true 150 0 150 300
  346. line half
  347. true
  348. 0
  349. Line -7500403 true 150 0 150 150
  350. pentagon
  351. false
  352. 0
  353. Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
  354. person
  355. false
  356. 0
  357. Circle -7500403 true true 110 5 80
  358. Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
  359. Rectangle -7500403 true true 127 79 172 94
  360. Polygon -7500403 true true 195 90 240 150 225 180 165 105
  361. Polygon -7500403 true true 105 90 60 150 75 180 135 105
  362. plant
  363. false
  364. 0
  365. Rectangle -7500403 true true 135 90 165 300
  366. Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
  367. Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
  368. Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
  369. Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
  370. Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
  371. Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
  372. Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
  373. sheep
  374. false
  375. 0
  376. Rectangle -7500403 true true 151 225 180 285
  377. Rectangle -7500403 true true 47 225 75 285
  378. Rectangle -7500403 true true 15 75 210 225
  379. Circle -7500403 true true 135 75 150
  380. Circle -16777216 true false 165 76 116
  381. square
  382. false
  383. 0
  384. Rectangle -7500403 true true 30 30 270 270
  385. square 2
  386. false
  387. 0
  388. Rectangle -7500403 true true 30 30 270 270
  389. Rectangle -16777216 true false 60 60 240 240
  390. star
  391. false
  392. 0
  393. Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
  394. target
  395. false
  396. 0
  397. Circle -7500403 true true 0 0 300
  398. Circle -16777216 true false 30 30 240
  399. Circle -7500403 true true 60 60 180
  400. Circle -16777216 true false 90 90 120
  401. Circle -7500403 true true 120 120 60
  402. tree
  403. false
  404. 0
  405. Circle -7500403 true true 118 3 94
  406. Rectangle -6459832 true false 120 195 180 300
  407. Circle -7500403 true true 65 21 108
  408. Circle -7500403 true true 116 41 127
  409. Circle -7500403 true true 45 90 120
  410. Circle -7500403 true true 104 74 152
  411. triangle
  412. false
  413. 0
  414. Polygon -7500403 true true 150 30 15 255 285 255
  415. triangle 2
  416. false
  417. 0
  418. Polygon -7500403 true true 150 30 15 255 285 255
  419. Polygon -16777216 true false 151 99 225 223 75 224
  420. truck
  421. false
  422. 0
  423. Rectangle -7500403 true true 4 45 195 187
  424. Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
  425. Rectangle -1 true false 195 60 195 105
  426. Polygon -16777216 true false 238 112 252 141 219 141 218 112
  427. Circle -16777216 true false 234 174 42
  428. Rectangle -7500403 true true 181 185 214 194
  429. Circle -16777216 true false 144 174 42
  430. Circle -16777216 true false 24 174 42
  431. Circle -7500403 false true 24 174 42
  432. Circle -7500403 false true 144 174 42
  433. Circle -7500403 false true 234 174 42
  434. turtle
  435. true
  436. 0
  437. Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
  438. Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
  439. Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
  440. Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
  441. Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
  442. Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
  443. wheel
  444. false
  445. 0
  446. Circle -7500403 true true 3 3 294
  447. Circle -16777216 true false 30 30 240
  448. Line -7500403 true 150 285 150 15
  449. Line -7500403 true 15 150 285 150
  450. Circle -7500403 true true 120 120 60
  451. Line -7500403 true 216 40 79 269
  452. Line -7500403 true 40 84 269 221
  453. Line -7500403 true 40 216 269 79
  454. Line -7500403 true 84 40 221 269
  455. x
  456. false
  457. 0
  458. Polygon -7500403 true true 270 75 225 30 30 225 75 270
  459. Polygon -7500403 true true 30 75 75 30 270 225 225 270
  460. @#$#@#$#@
  461. NetLogo 4.1.3
  462. @#$#@#$#@
  463. @#$#@#$#@
  464. @#$#@#$#@
  465. @#$#@#$#@
  466. @#$#@#$#@
  467. default
  468. 0.0
  469. -0.2 0 1.0 0.0
  470. 0.0 1 1.0 0.0
  471. 0.2 0 1.0 0.0
  472. link direction
  473. true
  474. 0
  475. Line -7500403 true 150 150 90 180
  476. Line -7500403 true 150 150 210 180
  477. @#$#@#$#@
  478. 0
  479. @#$#@#$#@