|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false9 v0 I2 F7 H \8 R1 F2 k0 V' o
to go) E. Z3 [% O _* x
if not any? turtles with [not stopped? ] [ stop ] 8 s2 U8 j" |% U" L" h
ask turtles with [remainder who 5 = 0] [
6 T q) `0 U% X" v8 a. r2 Uset close-mates (turtles with [self != myself])with[1 E/ y* ]! W# y" d$ B) w0 s
(abs(xcor -(xcor-of myself)) < X-Dist + Wid )
' T7 w4 S; `1 ]/ x* sand (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) 3 ^3 m) K7 z" `& E: \; s, D
and remainder who 5 = 0
; n$ G; i7 A, \; i6 X, T F] + b( J8 j$ N) A) }/ j
ifelse any? close-mates 7 f& g6 P. O2 L {
[ , ]- y0 f1 j9 `
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]
$ i N4 _& A; N* q8 B! t: w% a4 ?1 A; ?face closest-one7 e6 B4 [+ f2 E; \! U
rt 180
/ @' r L( F+ x$ t5 |9 f2 Lfd random-float step-size
. d) e- m) }: X& D- D2 Gavoid-walls
2 O! l& g( T/ a' lset stopped? false]
, O3 J7 k; |& T9 c+ ?[set stopped? true] 7 T$ t; G3 s# {1 g4 u+ U; Y$ W
] |
|