netlogo模拟的感染方法不起作用

netlogo模拟的感染方法不起作用,netlogo,Netlogo,下面的代码是病毒传播的简单模拟。它不起作用,我也不知道为什么ziek在代理发生变异时变为真(这是另一种方法,但已知正在工作)。该药剂也变成石灰。然而,我的代理只会变异,不会被感染。我做错了什么 to get-infected ask other turtles [ if color = gray and turtles-here = ziek [set color lime set ziek true]] end 因此,turtles here在调用方的补丁上报

下面的代码是病毒传播的简单模拟。它不起作用,我也不知道为什么<代码>ziek在代理发生变异时变为真(这是另一种方法,但已知正在工作)。该药剂也变成石灰。然而,我的代理只会变异,不会被感染。我做错了什么

to get-infected
  ask other turtles [
  if color = gray and turtles-here = ziek
    [set color lime 
      set ziek true]]

end

因此,
turtles here
在调用方的补丁上报告一组代理海龟(调用方可以是另一只海龟或一个补丁)。因此,如果
ziek
true
false
,那么在这里比较
turtles=ziek
没有多大意义,因为这些值在海龟的代理集合中永远不会相同(
=

要检查这里的
turtles
代理集中是否有任何成员生病,您需要与原语一起使用。我想你想要这样的东西:

to get-infected
  ask other turtles [
    if color = gray and any? turtles-here with [ziek] [
      set color lime 
      set ziek true
    ]
  ]
end
但是你也可以反过来说,当海龟看到其他生病的海龟时,你可以让生病的海龟来传染,而不是让它们自己传染。对我来说,这种设置更有意义

to go
  ; ... other go code to do turtle actions goes here
  ask turtles with [ziek] [
    infect-others
  ]
  ; ... more code here
end

to infect-others
  ask other turtles-here with [not ziek] [
    set color lime 
    set ziek true
  ]
end

对于那些不会说荷兰语的人:齐克病了。