distribute-turtles-arc_2009


Information

Created with NetLogo version NetLogo 4.0.4
Running with NetLogoLite.jar version 404.


;; Distributing a number of evenly spread out turtles
;; Copyright (C) 2006 James P. Steiner

Procedures

NetLogo Version: NetLogo 4.0.4


to distribute-turtles
   ca
   let radius 0
   let circumference 0
   let arc 360
   let angle 0
   let arclength spread
   let segments 1
   let counter 0
   let max-radius max-pxcor * sqrt 2
   while [ counter < population and radius < max-radius ]
   [ crt 1
     [ set color 5 + who * 10
       set size spread * .4
       set heading angle
       ifelse can-move? radius
       [ jump radius
         set counter counter + 1
       ]
       [ die
       ]
     ]
     set angle angle + arc
     if angle >= 360 - arc * .5
     [ ;; ring complete, calculate parameters of next ring
       set angle angle - 360
       set radius radius + spread
       set circumference pi * radius * 2
       set segments floor (circumference / arclength)
       set arc 360 / segments
     ]
   ]
end
   
   
to orbit
no-display
ask turtles
[ if pxcor != 0 or pycor != 0
  [ let d distancexy 0 0
    let h heading
    setxy 0 0
    set heading heading + 5 / d
    ifelse can-move? d
    [ jump d ]
    [ die ]
  ]
]  
display
end      
   
   
   

                    


Download Link

View or download the complete model file (to download: right-click, save-link-as):
-- Download distribute-turtles-arc_2009 --