distribute-turtles-hex_2009


Information

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



Procedures

NetLogo Version: NetLogo 4.0.4

;;;; 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      
   
   
   

                    


Download Link

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