NetLogo:海龟没有感染"彼此

时间:2017-04-20 06:49:23

标签: netlogo

我想创建一个关于群体免疫力的模拟。要做到这一点,我必须编写一种感染海龟的病毒。这是迄今为止的代码:

to setup
ask n-of (sick-turtles / 5) turtles with [color != red]
[set sick? true]


 ask turtles
[
if sick? = true
[
  set color green
]
]

ask turtles
[if color != red
[set immune? 1]
]

ask turtles 
[if color != green
[set sick? 1]
]
end

to go
if smallpox = 0
[
set infection-rate 99
set infectivity 6
set lethality 0
set recovery recovery-rate
set immunity (1 - (1 / infectivity)) * 100
]

to infect
ask turtles with [not immune? and not sick?]
[if any? (turtles-on patch-ahead 1) with [sick? = true] 
[if (random 100) < infection-rate
  [set sick? true]
]
]
end

然而,海龟根本没有相互感染。我究竟做错了什么?提前致谢。

0 个答案:

没有答案