我一直在寻找在海龟周围传播的方法,但我不明白。
这个想法是,我有一个昆虫种群(一种海龟),并且该昆虫种群会检查是否有可用的嵌套地。如果有一个并且没有其他昆虫种群,我希望这个补丁能够生成一个新的昆虫种群。到目前为止,我已经有了这个想法:
ask insect-populations
[
ask patches in-radius 2
[
if lay? = 1
[
if not any? insect-populations [ask self [sprout-insect-populations 1]]
]
]
]
提前感谢您的任何提示
最佳答案
ask insect-populations
[
ask patches in-radius 2 with [lay? = 1 and not any? insect-populations-here]
[sprout-insect-populations 1]
]
如果我正确理解你的意图,应该是你想要的。 诀窍在于[with]。它需要一个真/假 block 。因此,方括号内的 bool 语句的任何代理都包含在集合中。
关于netlogo - 如何在netlogo中的乌龟周围发芽?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34991449/