|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false
: R: s5 D8 A/ ~& W5 N7 Cto go7 M; u. b2 L4 \* \, B8 n: N+ p* O
if not any? turtles with [not stopped? ] [ stop ] 1 h g% H: m. q7 Q R3 t
ask turtles with [remainder who 5 = 0] [
: P3 Q% L4 c$ K( d+ r& Uset close-mates (turtles with [self != myself])with[
# k y" w0 f0 e(abs(xcor -(xcor-of myself)) < X-Dist + Wid )
* b5 R. ?& h- g) u* ?and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep )
; B$ N9 P1 P3 yand remainder who 5 = 0
% a# ]; a3 `: p5 N2 L) L1 V- ]]
2 g V" b3 b+ W: Q* y1 `* Rifelse any? close-mates
, N: v6 \) s3 B$ y[
& y, ^ L- V! d) b# I$ r1 l. aset closest-one min-one-of (close-mates with[self != myself] )[distance myself]" A/ W. k Q: E8 _! [ ?: A) g
face closest-one4 W/ z9 ]3 j# o& `6 H3 l. s0 L
rt 180
5 d' `; ]/ \# r$ W, Mfd random-float step-size
* u W1 w0 o2 K' favoid-walls" R3 D; @3 a1 E" a, \7 x
set stopped? false]/ ?" s7 n: w. j" v7 Q
[set stopped? true] 4 u3 a% |! t1 Q. o
] |
|