netlogo - Ask turtles to move to patch that is their state variable -
in model, have turtles start @ random location. location saved state variable home-xy
using patch-here
command. stored format (patch 234 345)
. want turtles return location @ end of procedure. i've tried following 2 pieces of code:
ask turtles [ move-to home-xy ] ask turtles [ let x [pxcor] of home-xy let y [pycor] of home-xy move-to patch x y ]
these not work, think represent problem enough. thank you.
not sure why first code didn't work. tested , it's fine (returns centre of patch started):
turtles-own [home-xy] setup clear-all create-turtles 20 [ setxy random-xcor random-ycor set home-xy patch-here ] reset-ticks end go ask turtles [ setxy random-xcor random-ycor ] end go-home ask turtles [ move-to home-xy ] end
you might want inspect turtle , make sure home-xy being set properly.
Comments
Post a Comment