|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false
2 l, c; s" Z0 F$ K' |% u5 g: fto go
3 b! G% U( |( @ Q' L) C* O0 s: }if not any? turtles with [not stopped? ] [ stop ]
( N0 i7 d0 _$ U, k/ Y6 Qask turtles with [remainder who 5 = 0] [- x+ [3 B9 t0 V' R- I
set close-mates (turtles with [self != myself])with[! ^6 m; ]! a2 r a% N% s
(abs(xcor -(xcor-of myself)) < X-Dist + Wid )
: F+ K$ ~1 p0 y$ O& O0 r6 v3 b3 Band (abs(ycor -(ycor-of myself)) < Y-Dist + Dep )
8 Z& q" ~) ?) n$ hand remainder who 5 = 0 4 t5 S3 f- r# ^ O
]
$ E4 }0 o: O+ c" y6 ^ \- ]: Yifelse any? close-mates : ^0 g, a; j. Q& ^$ o" t% }
[ 2 W4 h, _, ^; l) d
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]
' O& l& q( J$ O/ {! P* N7 H, rface closest-one
3 C) Y5 X G! k( O3 k1 `5 Xrt 1804 f' q7 Q4 o+ e% S, n& l6 `$ ]/ v
fd random-float step-size d3 s, ?- `( i% b1 l/ V$ s5 `$ t
avoid-walls
) y) |4 K2 M7 e# M8 O' O2 O3 I/ L7 y7 vset stopped? false]( q7 l! c+ W% b5 T
[set stopped? true]
& X( ^9 T" B: w2 B] |
|