|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false, A4 A6 z' _: ?
to go! C& n8 Y, V' X' W6 ^
if not any? turtles with [not stopped? ] [ stop ]
% t! ~3 N) R& M- oask turtles with [remainder who 5 = 0] [
. O5 A7 @% [2 _2 Z) Sset close-mates (turtles with [self != myself])with[
3 [) Z @9 X- I6 ]. \* a) @4 }(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) 7 m/ `1 i9 J) W+ h' {! ^
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep )
2 A( g6 h. [. U, R8 Y( {+ F3 dand remainder who 5 = 0
% Q; U& U# H' L! c] 7 E! S* A6 `, j/ ]$ y2 _8 G6 L
ifelse any? close-mates
# J& [% f& G4 i- r% ][
4 `+ w7 U% [2 Hset closest-one min-one-of (close-mates with[self != myself] )[distance myself]
, V5 ^. r( e. Nface closest-one
8 b1 m- G. H. L+ d8 \- E9 ^7 Krt 180# w, {+ f" X% a5 b
fd random-float step-size
6 D- ]8 J2 O- [5 H, v6 n% I4 bavoid-walls
. b7 T7 u# |% ~3 u P7 V7 z0 H' Oset stopped? false]
* ?2 a3 O$ D. ^2 D. @& a[set stopped? true] + d+ z7 `" G+ g/ U8 b& d
] |
|