在netlogo模型库中有一个virus on a network,里面有一个代码to spread-virus
& e, X( ^9 v: N7 B ask turtles with [infected?]
" @, `+ u S! [6 ] [ ask link-neighbors with [not resistant?]' u0 j* _& v* c0 P* S/ a
[ if random-float 100 < virus-spread-chance+ N. Z% K( R0 [+ k9 e* }% d
[ become-infected ] ] ]3 T4 _/ }1 Y1 q9 W, X/ {
end# e3 v" K, ~- ?& p- r
这里为什么virus-spread-chance大于random-float 100,就可以判断出become-infected呢?4 P$ M7 P w% a6 j# m+ q
to do-virus-checks
$ T$ [. c# m7 G0 J ask turtles with [infected? and virus-check-timer = 0]
% ^# ?0 z+ Z- b1 J7 d! t [
2 E8 g$ P# B; X if random 100 < recovery-chance
. ~6 V& H) U. i; F [
5 k e/ D4 F+ {: @$ r7 v5 c9 V7 G ifelse random 100 < gain-resistance-chance
, {7 T R$ b0 F7 i [ become-resistant ]- Q+ |" L9 x8 ?, J8 r
[ become-susceptible ]' `: x4 a6 c `/ `( F
]0 Z/ z8 v5 s! P& z% n8 _5 j
]3 l7 F$ x+ g0 M) f
end9 X# {5 B6 R% \! T# A
下面同样这个问题不明白/ f# T1 f4 h* i- L% C
小妹求大神帮忙!!
" i8 {( a; |; Q5 F+ ? |