在netlogo模型库中有一个virus on a network,里面有一个代码to spread-virus
8 y# c8 G' Z" V ask turtles with [infected?]% O/ O1 G9 t& d# e3 x0 f% h
[ ask link-neighbors with [not resistant?]7 e8 {2 z" V; X2 J
[ if random-float 100 < virus-spread-chance- O. ~& C- i' N* u! q- K% ^
[ become-infected ] ] ]
) c1 t$ \0 `- V8 z2 `" w; Bend
- z5 `4 X+ {- _: l% s( x# m这里为什么virus-spread-chance大于random-float 100,就可以判断出become-infected呢?4 { m" A6 C/ h) Y8 G, ~# r
to do-virus-checks
: _! |3 j+ O2 H" `+ [8 m ask turtles with [infected? and virus-check-timer = 0]
% Z" K. S8 L/ c' L$ m5 ` [/ P/ G. x5 z, e" \
if random 100 < recovery-chance
8 d( g8 A/ P( d% } [/ G6 Y* M4 ?3 s, \& I
ifelse random 100 < gain-resistance-chance% S% O1 Z' Z2 ?. u8 Y* G; V" X
[ become-resistant ]0 F8 X' }, ], n6 O3 \4 \/ _2 z
[ become-susceptible ]; S1 l7 L$ {6 o. Y. K+ E" a8 Q! t
]
5 c% X- c2 c% R1 m) r ]! f6 @# s. d' e
end& O0 h6 A3 i) [+ [; P) m
下面同样这个问题不明白( }: ?! Z+ M; ]# K! v
小妹求大神帮忙!! 1 v$ \1 l. e' ?$ l
|