如何连接半径 NetLogo 内的两只或多只海龟

How to get connected two or more turtles within radius NetLogo

我有更多的海龟在世界上移动,当它们在一个区域(圆圈)内时,我想让它们连接起来。

这是一个例子:

我正在尝试使用这样的函数,在 "go" 过程中调用(勾选高级),但这不起作用。 有什么建议吗?

to connect
ask turtles in-radius radius [
  create-link-from myself
  create-link-to myself
]
end

如果我明白你想要什么,这就可以了

globals [radius]

to setup
  clear-all
  create-turtles 50 [setxy random-xcor random-ycor]
  set radius 5
  connect
end

to connect
  ask turtles
  [ ask other turtles in-radius radius
    [ create-link-from myself
    ]
  ]
end

问题是您有 ask turtles in-radius ... 但没有指定参考点。也就是说,在什么的一定距离内?在我的代码中,我让每只海龟成为参考点,然后让在其自身距离内的海龟进行链接。