每个代理都有一个称为m-list的列表。每个代理都有不同数量的邻居(称为“队友”)。我希望每个代理将邻居的m-列表添加到他自己的m-列表中。
我无法删除过多的列表括号,而无法获取列表元素以将它们一一列出。另外,请注意,m-list的长度随代理而异。
ask turtles [
set flockmates (other turtles) in-radius communication-radius
;neighbours within a given radius
set m-list fput map [ i -> [m-list] of i ] sort flockmates m-list
show m-list
]
;I also tried this:
show sentence m-list map [ i -> [m-list] of i ] sort flockmates
if my m-list = [x y z]
and my two neighbours is [a b c d] and [s t] then,
m-list should be [ x y z a b c d s t]
and I receive something like: [[[a b c d] [x y z]] [s t]] :/