使用邻居的 netlogo 多集水区

netlogo multiple catchment area using neighbors

嗨,我是 netlogo 编程的新手, 我有一些问题.. 我正在尝试制作一个模型,其中海龟是在一个名为 home-patches 的分隔区域中创建的,并且必须进入其他名为 security-patches 的分隔区域。现在我希望海龟使用集水区进入这个安全补丁。问题是我已经制作了 10 个不同的安全补丁,面积为 3*3 补丁,并且我已经使用此代码生成了集水区

ask security-patches [set catchment-area other patches in-radius catchment-radius ]

我用"in-radius"命令设置了c-area的半径,catchment-radius是界面中的一个滑块

问题是它只在随机选择的安全补丁中的一个补丁中创建一个流域

如果它有用这里是我如何设置安全补丁和家庭补丁

set security-patches patches with 
   [(pxcor <= 3 and pycor <= 3) 
or (pycor >= 13 and pycor <= 16 and pxcor <= 3) 

or (pxcor <= 3 and pycor >= 26) 

or (pxcor >= 20 and pxcor <= 24 and pycor >= 26) 
or (pxcor >= 20 and pxcor <= 24 and pycor <= 3)
or (pxcor >= 67 and pycor >= 13 and pycor <= 16)
or (pxcor >= 49 and pxcor <= 53 and pycor >= 26)
or (pxcor >= 49 and pxcor <= 53 and pycor <= 3)
or (pxcor >= 67 and pycor <= 3)
or (pxcor >= 67 and pycor >= 26)]


 set home-patches patches with 
   [(pycor > 3 and pycor < 13) 
or ( pycor > 16 and pycor < 26) 
or (pxcor > 10 and pxcor < 20) 
or (pycor >= 13 and pycor <= 16 and pxcor >= 4 and pxcor <= 10)
or (pxcor > 3 and pxcor < 6 and pycor <= 3)
or (pxcor > 3 and pxcor < 6 and pycor >= 26)
or (pxcor >= 20 and pxcor < 67 and pycor >= 13 and pycor <= 16)
or (pxcor >= 6 and pxcor <= 10 and pycor >= 26)
or (pxcor >= 6 and pxcor <= 10 and pycor <= 3)
or (pxcor > 24 and pxcor < 49 and pycor >= 26)
or (pxcor > 53 and pxcor < 67 and pycor >= 26)
or (pxcor > 24 and pxcor < 49 and pycor <= 3)
or (pxcor > 53 and pxcor < 67 and pycor <= 3)]

我将世界的尺寸设置为 70*30

我试过你的代码。首先,我将集水区用作全局变量,世界按照您指定的方式运行,然后我尝试将集水区设置为每个补丁自己的集水区,以便每个补丁都有一个关联:

patches-own[
  catchment-area
]

所以现在使用您编写的命令来设置您只为安全补丁设置的集水区,并且每个集水区都等于 patches in-radius catchment-radius。 我希望这个解决方案可以为您服务。