|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false- q6 }, R9 y$ N) \4 U
to go
4 \( B# C% b) x. }if not any? turtles with [not stopped? ] [ stop ]
/ c" h, y+ \) Y( Oask turtles with [remainder who 5 = 0] [
; C5 \4 F* F3 l- \5 wset close-mates (turtles with [self != myself])with[4 n, n1 m w0 Y& s7 l
(abs(xcor -(xcor-of myself)) < X-Dist + Wid )
0 t0 K# f. L6 g0 Cand (abs(ycor -(ycor-of myself)) < Y-Dist + Dep )
( [. U; C# a: h" h1 wand remainder who 5 = 0
0 e, X% B/ C$ T7 H% g] . m! k, \- r6 R8 }# V
ifelse any? close-mates 1 h+ @0 W2 M& s% ~, ?8 B
[ 0 o/ P# O2 d1 l7 a P5 I
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]* o7 g, q( T2 ~( q) j7 g
face closest-one+ _2 @/ S) D" B8 y) Z$ K
rt 1800 R! f8 M) B$ H6 i
fd random-float step-size
4 k: v9 a3 E- Q9 g; v. ]/ Aavoid-walls3 g8 S2 I% @0 W" e7 P% z* T) z
set stopped? false]
$ c. G8 I( `7 A[set stopped? true] 2 E; ~2 @4 b% L, L# h
] |
|