使用 setxy 改变乌龟的坐标什么时候生效?

When does the change of coordinates of a turtle becomes effective using setxy?

如果我写:

to go
some code...
ask turtles[
    turtle-function
]
tick
end
;;previous coordinates : 2 2
to turtle-function
    setxy 3 5
    ask patch-at 1 0
    [
        some code...
    ]

end

"patch-at 1 0"的坐标是(4 5)还是坐标(3 2)?

重点是:坐标更新是在"tick"之后还是之前完成的??

自己找找应该很容易。如果您更换:

ask patch-at 1 0
[
    some code...
]

与:

ask patch-at 1 0
[
    print self
]

你得到:

(patch 4 5)

我想您可能对 when using tick-based view updates, the view is not updated until tick (or display) 被调用这一事实感到困惑。但在这种情况下,延迟的只是模型的视觉表示。一旦你 运行 一个有副作用的命令,比如 setxy.

,你的模型的底层 state 就会更新