|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false, \9 p7 Z _6 R5 l% o# k3 e, [, N
to go" Q3 R/ C f L) J/ R) @" ^7 Y
if not any? turtles with [not stopped? ] [ stop ]
5 g$ J7 }5 l3 yask turtles with [remainder who 5 = 0] [2 O% O: i) s8 _5 m4 x \: u
set close-mates (turtles with [self != myself])with[3 N! Q. N( v8 I0 W! v) f
(abs(xcor -(xcor-of myself)) < X-Dist + Wid )
* E% [ s5 z: j5 f! Xand (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) / g! e/ i% O2 Q1 B* ]4 {
and remainder who 5 = 0 6 I& b* N- G. }) V1 N2 a. X0 X
] 7 f6 G$ s0 J3 |4 ~$ B5 Z4 a
ifelse any? close-mates
; }" W' }0 u( v[ ( |$ C% M6 t3 N) S
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]
6 h, C2 @- ~, C8 k* S$ f* A* zface closest-one
# O1 e+ _) p: H/ i R4 qrt 180
1 I8 j" t. G: n, V, D$ N5 ~2 j0 lfd random-float step-size
( w0 K h) }3 s0 h! T. Pavoid-walls
- U# E/ T2 A9 l) W+ |set stopped? false]
% E6 J+ e$ k4 u; u6 T9 C( |[set stopped? true]
! \2 D8 h' U% p, }$ r] |
|