I want to setup turtles in NetLogo that are evenly distributed from min-xcor to max-xcor every 1 patch. Currently, what is clear is that turtles can be created with random-xcor and random-ycor. Please help.
Try using sprout
. sprout
tells a patch to create a turtle directly on top of it. So, for example:
ask patches [ sprout 1 ]
will create exactly one turtle on every patch. You can use with
to restrict the patches if you want do this in only part of the world:
ask patches with [ -6 < pxcor and pxcor < 10 ] [ sprout 1 ]
You can also include initialization code for the turtles just like you can with create-turtles
and hatch
:
ask patches [ sprout 1 [ set color red ] ]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With