|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false4 A! t5 K" R6 ~1 f% A
to go
* Q+ _+ A% J* F2 g7 mif not any? turtles with [not stopped? ] [ stop ] " h. `# J+ V6 A A A+ U& b9 I
ask turtles with [remainder who 5 = 0] [
4 `" Z$ t# N- H' iset close-mates (turtles with [self != myself])with[
]2 {% K' Q- }. C; G# n7 O$ R(abs(xcor -(xcor-of myself)) < X-Dist + Wid )
, I* S. s+ y* W; V" I! G9 B1 k% |and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) @: U0 p' \8 a: ^- L; M) y
and remainder who 5 = 0 0 m$ L: i0 r2 \3 m) {
]
( J0 \1 u2 c: V1 m+ _7 V5 E' c$ w# Bifelse any? close-mates
& J" x5 m, a- q[
$ e6 \: J l4 j1 j* E7 W$ k4 pset closest-one min-one-of (close-mates with[self != myself] )[distance myself]
" V' ^$ ?# J7 x) o0 ?% |face closest-one
: d/ ~* r. k2 P/ irt 180
C8 `, i* r5 y2 ufd random-float step-size) o t0 m% F0 \' V U3 N- D2 O
avoid-walls; z- N; S! z$ ~
set stopped? false]
3 p3 E/ h4 T, @* C9 J; E9 ]* s[set stopped? true] + o; ?8 `7 y) ~; ?; V) `5 d, R
] |
|