我想要比较特定半径内的补丁,关于它们上的特定类别的代理的数量。代理应该移动到大多数代理(在本例中是人类)所在的补丁。如果它们已经在人类最多的补丁上,那么它们就不能移动。我对它和人类组进行了编码,但他们中的大多数人都不会留下来,也不会排成一行(一排接一排)。如果你们中的任何人能快速浏览一下我的代码,那就太好了。谢谢
if Strategy = "Gathering-Simple" [
if ((count(humans-on max-one-of patches in-radius rad [count(humans-here)] )) ) >= count(humans-here) [
if count(humans-on patches in-radius rad) - count(humans-here) > 0 [
face max-one-of patches in-radius rad [count(humans-here)]
fd 1
]]
]发布于 2019-11-02 12:42:33
我同意之前的帖子,但有一些额外的信息。
如果您想在每次迭代中完全移动到目标面片,而不是只向目标面片移动一步,在上面的答案中,您可以替换产生一步运动的代码。
[ face target-patch
forward 1
]使用
[
move-to target-patch
]我通过实验证实,这两种移动方法的结果将产生相似但略有不同的结果。
https://stackoverflow.com/questions/58647500
复制相似问题