将海龟移动到补丁的代理集中
Moving turtles to agentset of patches
如果我 select 补丁的代理集,例如:
<observer> let myset patches with [abs pxcor < (grid-size / 2) and abs pycor < (grid-size / 2)]
<observer> ask myset [print self]
(patch 1 -1)
(patch -1 -1)
(patch 0 0)
(patch 1 0)
(patch 0 1)
(patch 0 -1)
(patch 1 1)
(patch -1 1)
(patch -1 0)
如何将我所有的海龟(与我的 selected 补丁一样多,所以 9 个)每一个都移动到不同的补丁?
我尝试了以下方法:
ask turtles [
move-to one-of myset
]
但现在不同的海龟可能在同一个补丁上。我怎样才能避免这种情况?
假设补丁上没有任何其他海龟,然后让他们选择一个空补丁(不确定语法是否正确,但类似):
ask turtles [
move-to one-of myset with [not any? turtles-here]
]
如果我 select 补丁的代理集,例如:
<observer> let myset patches with [abs pxcor < (grid-size / 2) and abs pycor < (grid-size / 2)]
<observer> ask myset [print self]
(patch 1 -1)
(patch -1 -1)
(patch 0 0)
(patch 1 0)
(patch 0 1)
(patch 0 -1)
(patch 1 1)
(patch -1 1)
(patch -1 0)
如何将我所有的海龟(与我的 selected 补丁一样多,所以 9 个)每一个都移动到不同的补丁?
我尝试了以下方法:
ask turtles [
move-to one-of myset
]
但现在不同的海龟可能在同一个补丁上。我怎样才能避免这种情况?
假设补丁上没有任何其他海龟,然后让他们选择一个空补丁(不确定语法是否正确,但类似):
ask turtles [
move-to one-of myset with [not any? turtles-here]
]