|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false
9 F3 T6 u! k- g* Hto go
7 a+ r* i9 H* L# rif not any? turtles with [not stopped? ] [ stop ] 1 q0 U, y g: f% X; L* v6 Q
ask turtles with [remainder who 5 = 0] [
2 g- K9 a' c5 F3 U% u N) gset close-mates (turtles with [self != myself])with[
2 W5 ~$ {& ]: B& e* m) X(abs(xcor -(xcor-of myself)) < X-Dist + Wid )
. q5 y' J C$ U fand (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) ( z( H0 J( h B/ I9 l
and remainder who 5 = 0 $ e& K7 Q! _! J. Z/ s
] * {3 v/ y9 d: c+ s
ifelse any? close-mates
7 b6 ` t4 C. [[
) O% p i7 b Dset closest-one min-one-of (close-mates with[self != myself] )[distance myself]
) _6 \% G. z |4 O, @% jface closest-one
" q. ~) f# S, Krt 180% }3 c! ^1 w4 Q0 l: n: W
fd random-float step-size
+ |0 s! G5 D4 V+ Y9 Aavoid-walls
# g: l! Z, ?. Zset stopped? false]
. _2 m& c: v* I# C" ]9 \2 p }[set stopped? true]
- j2 N: \9 Y. T$ f7 x4 @] |
|