在netlogo模型库中有一个virus on a network,里面有一个代码to spread-virus
, W7 y9 l, n/ ?4 C1 N3 z ask turtles with [infected?]
/ b3 s3 Y9 V7 |. j [ ask link-neighbors with [not resistant?]
: x! F4 v- D5 p/ M N$ A* L/ C. x8 G [ if random-float 100 < virus-spread-chance
, o+ Y- _* ` }7 U3 c/ g% G [ become-infected ] ] ]
) N- q" Q; W/ |/ _/ J! Mend$ f' {8 e& Q4 l4 @. f- n. a. ]# S
这里为什么virus-spread-chance大于random-float 100,就可以判断出become-infected呢?
. B% q) i! J0 H% a- i7 mto do-virus-checks
# J/ D v% ]$ x- A, {0 y0 A ask turtles with [infected? and virus-check-timer = 0]
/ Z/ S8 @3 I- C( [1 V y( i& A [9 m8 v" W* i. u$ l b) ]
if random 100 < recovery-chance
+ R# f3 D7 }+ X# n [! ]" y+ f$ w% W6 J# d6 E' N8 }" y
ifelse random 100 < gain-resistance-chance
( }& z( a/ n* L* h [ become-resistant ]9 A) G s6 q% S4 y. j# b& r
[ become-susceptible ]: l- h& H* B9 n3 j
]; P# f' q/ A. x6 p6 V
]1 D" ~1 n; B6 i& s! @; P
end
+ e4 M2 J- M* p* `. \下面同样这个问题不明白) B. U' `. a* t3 r2 ]
小妹求大神帮忙!!
* b6 s4 U% l! W. _4 h' [ |