|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false! D3 Q' S7 W s3 i% Z
to go! O1 ~4 t$ c& x5 `, R1 U
if not any? turtles with [not stopped? ] [ stop ]
6 c1 {" p/ ]# S* Q9 o& qask turtles with [remainder who 5 = 0] [! N. E4 Q- h: E8 C
set close-mates (turtles with [self != myself])with[. ~( z! Z& C" k P. r
(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) ! a* L( X- _* v' T
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) & J, e! U* y7 G/ ^" _5 _7 E0 M8 \
and remainder who 5 = 0
: q7 a( m7 W8 Z. R4 U]
6 s- G# {7 p4 [5 xifelse any? close-mates
; E) n3 f/ P b3 }[
4 a9 N# M* D+ Q. _! W( \! k. C% mset closest-one min-one-of (close-mates with[self != myself] )[distance myself]
/ @* u% Z, b1 D$ Z- _# vface closest-one: y" I0 H- u3 w1 C4 F
rt 1800 E, ?0 ]- _( y
fd random-float step-size( b0 J9 T1 |6 L5 m
avoid-walls& U) d; _) M0 B5 W
set stopped? false]. f5 K8 P# M! W# G
[set stopped? true] ; `0 u) i- \: K9 n
] |
|