;;;; SUMMAry ;; A demo of using at-points to precalculate a region of patches under a turtle ;;;; CoPYriGHT ;; Copyright (C) 2006 James P. Steiner. Some Rights Reserved. ;; Licensed under a Creative Commons nc-at-sa 2.5 license. ;; Visit Creative Commons for details ;; turtles-own [ shadow ] to startup setup end to setup ca cct 1 [ set size 5 set shadow n-values ( size * size ) ;; number of points [ ( list ;; define coordinate offsets ( ( ? mod size ) - int ( size * .5 ) ) ;; x offset ( int ( ? / size ) - int ( size * .5 ) ) ;; y offset ) ] ] ask n-of 100 patches [ set pcolor red ] end to go ;; turtle procedure ask turtles [ rt 5 - random-float 10 jump 1 if pcolor = red [ ask patches at-points shadow [ set pcolor green ] ] ] end @#$#@#$#@ GRAPHICS-WINDOW 84 10 499 446 40 40 5.0 1 10 1 1 1 0 1 1 1 -40 40 -40 40 CC-WINDOW 5 460 508 555 Command Center 0 BUTTON 11 10 74 43 NIL setup NIL 1 T OBSERVER T NIL BUTTON 12 63 77 96 NIL go T 1 T OBSERVER NIL NIL @#$#@#$#@ @#$#@#$#@ default false 0 Polygon -7500403 true true 120 150 120 180 180 180 180 120 120 120 120 150 0 150 0 0 300 0 300 300 0 300 0 150 link true 0 Line -7500403 true 150 0 150 300 link direction true 0 Line -7500403 true 150 150 30 225 Line -7500403 true 150 150 270 225 @#$#@#$#@ NetLogo 3.1 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@