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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -