根据我的问题yesterday,我尝试使用filter
和length
来实施代码。我想我已经实现了filter
但现在我需要代理将它们的列表长度与其他代理(活动)列表进行比较。这是我的代码:
ask agentes [
set culture-tags n-values 17 [random 2]
set shared-culture (filter [ i -> i = 0 ] culture-tags) ;count 0s and
create shared-culture
]
end
to move-agentes
ask agentes [
let nearest-activity min-one-of (activities) [ distance myself ]
ifelse any? activities in-radius sight-radius with
[ length t-shared-culture = length shared-culture ] ;as many 0s in t-shared-culture (specified later in the setup for activities) as in shared-culture
[ face nearest-activity ]
[ rt random 40
lt random 40
fd 0.3
]
]
Netlogo打印下一个错误:"ACTIVITIES breed does not own variable SHARED-CULTURE error while activity 176 running SHARED-CULTURE"
。
我想错误必须在这里:[ length t-shared-culture = length shared-culture ]
但我不知道如何让两个列表进行交互。