|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false+ g0 Q) q- n& m. t1 _2 H
to go. b9 N% I# ~( G2 v! i, O, c% f
if not any? turtles with [not stopped? ] [ stop ]
* q9 r& L' n" t B7 W. V$ h$ Rask turtles with [remainder who 5 = 0] [
8 ~8 b/ M1 v! | Hset close-mates (turtles with [self != myself])with[
6 V% R) @. i. r1 ~3 a(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) 4 v* F/ I( e& M: o( B/ b) v8 j
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) 3 n* Q# S* m6 [- R, E( \
and remainder who 5 = 0 , f1 a* [/ M2 I/ P& a# F U
]
6 l0 T# p# A7 Eifelse any? close-mates 0 h; \( W2 h- N' n
[ & g. i0 j& H ^3 q: H7 S3 z& X1 p2 ~, m
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]
& n% U6 e; q p) yface closest-one$ s0 R2 j1 ~7 o4 g& ?0 c
rt 180$ O ], B8 [* j2 g) y
fd random-float step-size
+ q \9 X# ~- savoid-walls2 q2 d1 D2 A& K+ R8 R3 g& g
set stopped? false]! b! w5 f# S# Z. T; H
[set stopped? true]
* H+ s/ b' w! w. q4 [2 @0 a] |
|