在netlogo模型库中有一个virus on a network,里面有一个代码to spread-virus. i" t, X$ e7 a# Q1 v
ask turtles with [infected?]
% C2 D% p4 V: f [ ask link-neighbors with [not resistant?]
2 k7 d/ ?9 `" i* ]- D4 U [ if random-float 100 < virus-spread-chance- @# A2 H7 k( |4 M6 f9 e
[ become-infected ] ] ]
+ F k( l6 D: r4 w& vend" L' d( M! ~/ d& g" z
这里为什么virus-spread-chance大于random-float 100,就可以判断出become-infected呢?. ^+ f8 t6 A! V7 i
to do-virus-checks
; ~& o& p' i) m. L3 M8 ]! y ask turtles with [infected? and virus-check-timer = 0]
. H& f+ {6 p' S1 Y M [
" a' X7 K5 e- ^) r- ~/ Z if random 100 < recovery-chance: S" ~/ v* a* t* p6 V
[0 E) R" b7 [3 U/ N
ifelse random 100 < gain-resistance-chance$ H+ O9 ~. y3 A& o
[ become-resistant ]
3 O, [3 `% X% S+ X& k [ become-susceptible ]
0 j$ V T9 w6 M2 \ ]
1 z4 W1 P( \4 B1 `7 [, ^ ]
" \6 T* Q/ T" s+ Y; o7 X% v2 D- {end/ u4 m% M) U: W
下面同样这个问题不明白% i( K* R% p1 v: L, f9 A# A( x
小妹求大神帮忙!!
/ S# f0 A5 u( T8 T0 D |