;;;; SUMMARY ;; Distributing a number of evenly spread out turtles ;;;; Copyright & License ;; Copyright (C) 2006 James P. Steiner ;; You are granted a CC 2.5 by-nc-sa license to this model ;; ;; to distribute-turtles ca let side ceiling sqrt population ask patches with [ pxcor - min-pxcor < side and pycor - min-pycor < side ] [ sprout 1 [ set color 5 + who * 10 ] ] ask turtles [ let newx pxcor + ((pxcor - min-pxcor) * .8660 * (spread - 1)) let newy pycor + ((pycor - min-pycor) * (spread - 1) + spread * (ifelse-value ( (pxcor ) mod 2 = 0) [ 0 ] [ .5 ])) ifelse newx > max-pxcor or newy > max-pycor [ die ] [ setxy newx newy set size spread set heading 0 set shape use-shape ] ] if (count turtles) > population [ ask n-of (count turtles - population) turtles [ die ] ] tick end to orbit ask turtles [ if pxcor != 0 or pycor != 0 [ let d distancexy 0 0 facexy 0 0 rt 180 let h heading setxy 0 0 set heading heading + 5 / d ifelse can-move? d [ jump d ] [ die ] ] ] tick end @#$#@#$#@ GRAPHICS-WINDOW 190 10 503 344 50 50 3.0 1 10 1 1 1 0 0 0 1 -50 50 -50 50 1 1 0 ticks CC-WINDOW 5 358 512 453 Command Center 0 SLIDER 10 10 182 43 spread spread 1 10 7 1 1 NIL HORIZONTAL SLIDER 10 46 182 79 population population 100 10500 200 100 1 NIL HORIZONTAL BUTTON 11 135 135 168 NIL distribute-turtles NIL 1 T OBSERVER NIL NIL NIL NIL MONITOR 11 173 94 218 NIL count turtles 3 1 11 BUTTON 10 231 77 264 orbit orbit T 1 T OBSERVER NIL NIL NIL NIL BUTTON 90 232 156 265 pretty set color scale-color blue heading 0 360\nset size spread\nset shape \"circle\" NIL 1 T TURTLE NIL NIL NIL NIL CHOOSER 10 84 148 129 use-shape use-shape "circle" "hex" 1 @#$#@#$#@ @#$#@#$#@ default true 0 Polygon -7500403 true true 150 5 40 250 150 205 260 250 circle false 0 Circle -7500403 true true 0 0 300 hex true 0 Polygon -7500403 true true 0 150 75 15 225 15 300 150 225 285 75 285 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 tree false 0 Circle -7500403 true true 118 3 94 Rectangle -6459832 true false 120 195 180 300 Circle -7500403 true true 65 21 108 Circle -7500403 true true 116 41 127 Circle -7500403 true true 45 90 120 Circle -7500403 true true 104 74 152 @#$#@#$#@ 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 @#$#@#$#@