|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false: y* \9 u; b {& n* s
to go+ ]/ d# L+ o0 r
if not any? turtles with [not stopped? ] [ stop ]
% W. @# B3 C+ [8 Eask turtles with [remainder who 5 = 0] [
0 P! H! b2 N! N: j9 Z& iset close-mates (turtles with [self != myself])with[9 }: a+ F+ J. z9 i
(abs(xcor -(xcor-of myself)) < X-Dist + Wid )
* [3 }& R7 a. hand (abs(ycor -(ycor-of myself)) < Y-Dist + Dep )
, f# A! f+ _# S" K) ?& aand remainder who 5 = 0
. l' B1 q5 I2 b] 1 c8 r) ]% P4 D9 @
ifelse any? close-mates
5 M+ E$ p# S" X9 c9 [( g# m3 d1 x[
5 s9 C7 Z' x1 h$ K$ Xset closest-one min-one-of (close-mates with[self != myself] )[distance myself]
$ c. I* B% u# V( cface closest-one; b9 q" Q3 U( O. x
rt 180. s3 G8 l7 M# R' k1 r0 I' Y
fd random-float step-size
8 `7 O7 f, a, ~& Tavoid-walls
! z! s0 q {4 A" zset stopped? false]
8 Z5 `# z6 b1 Q2 D4 E$ p) f[set stopped? true] ( ^4 F. @( N+ W/ t$ m
] |
|