distance - NetLogo:测量 2 个补丁之间的最大距离

标签 distance netlogo

我的问题真的很琐碎,但作为 NetLogo 的初学者,我仍然找不到我的答案..

我创建了一个斑驳的表面(可在此处获得:basic nlogo code)

to setup
  clear-all
  setup-patches
  reset-ticks
end

;create patchy surface

to setup-patches
  ask n-of 5 patches [ set pcolor green ]
  ask patch 0 0 [ set pcolor yellow ]
  show max-one-of patches with [pcolor = green] [distancexy 0 0]
end

我想用[pcolor = green]测量点0 0(黄色)和最远的补丁之间的距离。

在NetLogo中测量距离,我发现了两种可能:

  • distance 显示最远绿色补丁的坐标(对此不感兴趣)
  • distancexy 测量到我的点(我想要的)的欧氏距离

我尝试创建监视器以使用

观察距离测量
  • max-one-of patch with [pcolor = green] [distancexy 0 0 ] -> 返回我的 patch 坐标和
  • [distance patch 0 0 ] of max-one-of patches [distance myself] -> 返回 N/A。

请问,如何将这个距离值包含到我的代码中?如果我必须创建补丁自己的变量,我该如何将它包含到我的代码中?

非常感谢,

enter image description here

最佳答案

尝试使用max:

max [distancexy 0 0] of patches with [pcolor = green]

关于distance - NetLogo:测量 2 个补丁之间的最大距离,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30675075/

相关文章:

python - 计算距离并打印出来

java - 如果排序字段为 "",lucene 如何使用比较器处理排序字段

iPhone 加速度计速度和距离

button - NetLogo: "stop"不能永远从另一个程序按钮吗?

simulation - 如何在netlogo中制作累计总和列表

gis - NetLogo GIS : dealing with large shapefile

math - 具有周期性边界的晶格上的距离

java - 如果我们知道距离 x1, y1, y2 则计算 x2

netlogo - 代表其他海龟内存的海龟变量

wav - 写入 netlogo 中的声音文件 : or how to tune netlogo