turtles-own [ shadow ] to startup setup end to setup ca crt 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 0 0 1 ticks CC-WINDOW 5 460 508 555 Command Center 0 BUTTON 11 10 74 43 NIL setup NIL 1 T OBSERVER NIL NIL NIL NIL BUTTON 12 63 77 96 NIL go T 1 T OBSERVER NIL NIL NIL NIL @#$#@#$#@ == WHAT IS IT? == A demonstration of using the n-values primitive to pre-calculate a list of coordinates that can be used with at-points to generate a non-standard neighborhood. One could use the method to generate pre-calculated neighborhoods for patches, too. For a patch (or a non-moving turtle) greater efficiency can be achieved by going one step further and converting the list of coordinates to the agentset of patches (or turtles, if needed) that are covered by the neighborhood. A demo of using n-values and at-points to generate a neighborhood under a turtle Copyright © 2006,2009 James P. Steiner. @#$#@#$#@ 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 4.0.4 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ default 0.0 -0.2 0 0.0 1.0 0.0 1 1.0 0.0 0.2 0 0.0 1.0 link direction true 0 Line -7500403 true 150 150 90 180 Line -7500403 true 150 150 210 180 @#$#@#$#@