乌龟仍然可以移动到一些补丁但是错误

There are still some patches that turtle can move on to but ERROR

我让一只乌龟 A 移动到一个补丁,该补丁有一个邻居与乌龟 A 有相同类型的乌龟。它运行良好,直到出现错误(MOVE-TO 预期输入是一个代理但没有得到 NOBODY相反)出来。视觉上仍然有一些可用的补丁。如何编写代码使所有可用的补丁都被占用,并在没有更多补丁可占用时报告或停止程序?任何评论都会非常有帮助。我做了以下事情:

to set-move
 ask migrants
  [let pot-target patches with [value < 11 and not any? turtles-here]
   let target pot-target with [count neighbors with [any? turtles-here with [value < 11]] = 1]
    ifelse target != 0 and (status != "resident") [move-to min-one-of target [value]
                                              set status "resident"
                                              set color blue]
                                              []   
  ] 

end 

这是完整代码

breed [migrants migrant]
breed [residents resident]

patches-own [value]
turtles-own [income
status]

to setup
  ca
  let total problo + probmid + probhi
  if (total != 100) 
     [print (word "prob is more than 100")]
  ask patches [set value random-normal 10 3
  let patch-value value
    set pcolor scale-color (gray - 5) patch-value 10 3]
  ask patches
  [if random 100 < 3
    [sprout-residents 1
      [set color red
       set shape "default"
       set size 1
       set status "resident"   
      ]
    ]
  ]
end

to go

  ask patches 
  [if random 100 < 1 
    [sprout-migrants 1
      [set color green
       set shape "default"
       set size 1 
        set status "migrant"
       set-move 
  ]]]

end

to set-move
 ask migrants
  [let pot-target patches with [value < 11 and not any? turtles-here]
   let target pot-target with [count neighbors with [any? turtles-here with [value < 11]] = 1]
    ifelse target != 0 and (status != "resident") [move-to min-one-of target [value]
                                              set status "resident"
                                              set color blue]
                                              []   
  ] 

end 

此行:let target pot-target with [count neighbors with [any? turtles-here with [value < 11]] = 1] 标识恰好有 1 个邻居满足这些条件的补丁。因此,具有 2 个这样的邻居的补丁将不可用。根据你的描述,我认为你真的想要 >= 而不是 =:

let target pot-target with [count neighbors with [any? turtles-here with [value < 11]] >= 1]