如何从没有海龟的代理集中 select 补丁?

How to select patches from an agentset with no turtles?

所以这是我认为合理的代码:

let movable-patches ( [ neighbors ] of selected-turtle with [not (any? other turtles-here)])

我想要 agentsetpatchesselected-turtle 相邻(这是一个 turtle 对象),这些邻居不应该有 turtles-here .

但是,它给了我一个 运行 时间错误:

WITH expected input to be an agentset but got NOBODY instead.

这是一个括号问题。这是演示固定代码的完整模型。

to testme
  clear-all
  create-turtles 10
  [ setxy random-xcor random-ycor
    set color blue
  ]
  selection
end

to selection
  let selected-turtle one-of turtles
  ask selected-turtle [set color red]
  let movable-patches ([ neighbors ] of selected-turtle) with [not (any? other turtles-here)]
  ask movable-patches [ set pcolor red ]
end

我有这样的括号:([ neighbors ] of selected-turtle)。你让他们围绕 [ neighbors ] of selected-turtle with [not (any? other turtles-here)]。问题是 with 是高优先级运算符并且先行(就像乘法在加法之前完成)。因此,您实际上是在要求 NetLogo 找到 selected-turtle with [not (any? other turtles-here)],然后取其中的 neighbors