在netlogo模型库中有一个virus on a network,里面有一个代码to spread-virus9 U( \7 T) Z- C) q6 F
ask turtles with [infected?]+ n+ L4 W# f- F1 }: I# E
[ ask link-neighbors with [not resistant?]" S, l4 L: H/ [/ s
[ if random-float 100 < virus-spread-chance
' Z6 o5 y5 Q1 Z% ^6 Y% M4 m [ become-infected ] ] ]1 t* e& }1 Y; @8 c
end- T3 r" I( }+ `7 }9 y9 T, l
这里为什么virus-spread-chance大于random-float 100,就可以判断出become-infected呢?
0 `0 R& C3 J! r" [to do-virus-checks, z% z3 K; T- Y4 v. J
ask turtles with [infected? and virus-check-timer = 0]4 H Z; g0 b0 d. N I
[, @; r5 {6 \/ F
if random 100 < recovery-chance/ e# \7 P7 a0 |7 f/ ^+ ?( m7 f5 l- [
[% G# D+ p0 T9 O; p
ifelse random 100 < gain-resistance-chance
: {0 v1 l. @+ }; a ?9 \- u# a' K [ become-resistant ]* O" }+ M8 s# l: Q
[ become-susceptible ]
! \; }" g0 u% b ]/ i! o, s3 t6 n7 B6 N! |
]
- A$ L2 R. i" k f) Tend( u' k5 `: c9 V9 [
下面同样这个问题不明白5 R/ z F" v1 ^7 p
小妹求大神帮忙!!
4 W9 C% s# P3 z |