在netlogo模型库中有一个virus on a network,里面有一个代码to spread-virus
3 j) [& O* @" g ask turtles with [infected?]3 R6 x, _2 M* w$ R- h, D
[ ask link-neighbors with [not resistant?]
( d1 ]9 o4 @' G+ v, ~1 R [ if random-float 100 < virus-spread-chance
: j2 K- E2 |0 W2 J, p9 k [ become-infected ] ] ]
9 }9 C( A. r1 gend1 R8 Q# u1 t2 O1 l- v6 _" U
这里为什么virus-spread-chance大于random-float 100,就可以判断出become-infected呢?
: r( K; C/ S# I, e5 H1 tto do-virus-checks) b, z9 D! i( ^ m+ b
ask turtles with [infected? and virus-check-timer = 0]
8 x/ g4 x9 _ t! ?- a' w0 f9 v4 S [
; Q0 w) c( ?; |0 w" D" w1 s if random 100 < recovery-chance" D9 q2 x- @' t* O
[
$ y& q! w2 J2 |* I0 C ifelse random 100 < gain-resistance-chance n% X" \2 G( T. U
[ become-resistant ]* M! {8 P; I" G4 ~# h0 @& i
[ become-susceptible ]4 _/ w- i$ ]' U; ]! J5 z1 w z
]$ }2 Q( d2 ]; y4 ]6 a! Y. J9 o
]- z$ ?3 U# [, u2 o
end
0 E" M/ K( U9 `; R下面同样这个问题不明白
' f( I0 ]. L/ J! c: R+ d( h* J9 `& y小妹求大神帮忙!! 5 d8 ?: a* C3 m1 p4 e, d F$ M+ c' y
|