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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -