在netlogo模型库中有一个virus on a network,里面有一个代码to spread-virus/ s! P! c- S, O$ X8 Q6 Z9 ~
ask turtles with [infected?]
$ \' |: p g: J; O [ ask link-neighbors with [not resistant?]
$ n) z. Z. o. Z( j% h5 l [ if random-float 100 < virus-spread-chance
2 p7 j" }2 J% ~, ?- m. `* F [ become-infected ] ] ]$ K5 i6 M' Y0 C: Z4 f4 T
end$ |) P5 ]( Z) y' }; E
这里为什么virus-spread-chance大于random-float 100,就可以判断出become-infected呢?
* [% a) L4 U' B. a& S/ M0 bto do-virus-checks3 H7 T& L, b* J; i. w
ask turtles with [infected? and virus-check-timer = 0]
8 {5 y8 S* L) l0 X) {' Y. D1 G' T5 b [
# K s+ _" g4 f3 V* F0 O! ?" }7 i if random 100 < recovery-chance& i6 P" U* s' R( a+ o5 K
[; W- D7 B! t$ w, H$ I# J! s
ifelse random 100 < gain-resistance-chance
6 _) @9 H ?1 d% M; x6 k5 l8 t [ become-resistant ]
3 h* K! Z% \3 k% K [ become-susceptible ], a& X% v8 E9 A" {9 N+ s! @: ?
]
7 d P9 d# K, C8 d ]7 r6 i- K0 `" B, W& M! d
end
4 Q& s3 O1 H1 ?# @/ x" e7 F下面同样这个问题不明白
9 ]9 B5 q- |6 m C小妹求大神帮忙!!
2 f! k$ y4 }/ ]$ g: _& @, |. v |