|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false
1 A' A4 C5 [3 Mto go, X& l: e N/ o& j
if not any? turtles with [not stopped? ] [ stop ]
0 _& ?0 s2 J- G- p7 \ask turtles with [remainder who 5 = 0] [
, r$ d9 T3 G% [! N- _, S+ h6 o% Aset close-mates (turtles with [self != myself])with[! O: a! I1 R( `% p; T. Z; }
(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) 7 _; n$ Z0 G& g
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) ! n+ h7 O) v' h, C/ r9 E
and remainder who 5 = 0
o5 F0 t2 z+ s/ B0 A9 t. \+ s- c]
$ B, a6 S3 @9 L- S3 _: J6 ^ifelse any? close-mates 3 Y( e) Q+ [. ^# a1 Z8 C) l
[
3 ~% B% G7 ]( H! i9 Dset closest-one min-one-of (close-mates with[self != myself] )[distance myself]- T- x' K) [' {7 G1 W W' H
face closest-one1 [ s3 T) G, b/ f, z
rt 180( ?$ F# Z q4 q6 V
fd random-float step-size6 J# s& M0 D+ B& d+ I! a9 {
avoid-walls) @8 U# Z$ `: N+ u$ e$ q
set stopped? false]
. t9 h, [. d8 J/ p& ]4 C* r[set stopped? true]
@2 t1 ]$ [9 |& n5 j3 o+ ]" [] |
|