How would you create turtles on a patch with a given speed and heading?
I tried using sprout to generate patches on a specific patch, but after looking in the Netlogo dictionary I found that this command creates turtles with random speeds and titles. Likewise, (crt) only creates the turtles at the origin, and I believe that by specifying the coordinates, you can distinguish where the turtles were born. The problem with both of these options is that they limit the ability of users to create and test road networks for themselves in the UI, and I am looking for a command or piece of code that will allow me to create turtles with given headers and speeds to set a patch of a specific color. Here's some sample code I'm using:
globals[road? ]
turtles-own [speed]
breed[cars car]
breed [sinks sink]
to setup
clear-all
ask patches [set pcolor green ]
set-patch-size 50
if mouse-down?
[ ask patch mouse-xcor mouse-ycor [ edit-world-primary ]
]
end
to go
if mouse-down?
[ ask patch mouse-xcor mouse-ycor [ edit-world-primary ]
]
edit-world-secondary
ask turtles-on patches with[pcolor = blue][set heading 90 ]
ask patches [if pcolor = blue [sprout 2 ] ]
ask turtles[
set shape"car"
set color white
set speed 90]
ask turtles[ rt 0 fd speed set heading 90 ]
end
Any help on changing the commands I use in my code is greatly appreciated.
+3
source to share