Search code examples
netlogo

NetLogo: Is there a syntax that can be used instead of "crt 1" in a turtle context?


Is there a syntax that can be used instead of "crt 1" in a turtle context? Because 'crt 1' syntax is observer-only. The following codes is sample one but it's not work well because of it's in a turtle context. I want to get some advice in this sample case. Thank you.

to one-turtle
crt 1 [
set color green
setxy min-pxcor 0
set heading  90
]
end

to go
ask (turtles-on patch min-pxcor 0)[
if create = true [one-turtle]]
end

Solution

  • You can use hatch instead of crt.

    Just be aware that the newly created turtle will inherit the values of its parent's variables, so you'll have to set those manually if you want them to be something else.

    (And if you had to ask a patch to create a turtle, the primitive to use would be sprout.)