在我的设置中,我使用以下代码创建名为"darks"的代理,这些代理被分配给一组指定的补丁(免费补丁)。
我正试图将每只海龟分配到指定区域内的一个随机补丁,而不让任何海龟共享一个补丁。
我偶然发现代码告诉一个补丁长出一只特定的乌龟,但我能在不借助补丁长出的情况下实现我的目标吗?
create-darks #-of-darks [
set shape "person"
set size 1
set color black
move-to one-of free-patches
]
你可以得到一个没有深色的补丁。我也只会创造一个黑暗,如果有足够的空间。
let n-or-remaining-spaces min (list n (count patches with [not any? darks-here]))
create-darks n-or-remaining-spaces
[
;;Your other setup code
move-to one-of patches with [not any? darks-here]
]