|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false7 o) T! N) i; \, o3 ]4 P7 X+ K
to go
4 S. i4 G) P$ x m3 I( Kif not any? turtles with [not stopped? ] [ stop ] 5 s; k2 f2 u1 J# c
ask turtles with [remainder who 5 = 0] [1 X. E! @, {9 L( V% \8 H0 h5 ]
set close-mates (turtles with [self != myself])with[, r2 @9 z; Z. R0 k; C9 U- ~0 D/ g
(abs(xcor -(xcor-of myself)) < X-Dist + Wid )
" V: E- ~5 B) K( @% A% land (abs(ycor -(ycor-of myself)) < Y-Dist + Dep )
: k* |2 n& u' e$ Hand remainder who 5 = 0
- H) B& W% O# N' a. t3 V]
& V- j' H7 R4 s! M vifelse any? close-mates ' a$ u% l7 d) S) I# ]& }1 Z# a/ X- _
[
$ X# O S& g" m1 U) h) a7 n- Nset closest-one min-one-of (close-mates with[self != myself] )[distance myself]
% v; s; K% H7 O3 ^face closest-one5 `5 s: G e9 v4 l$ `2 [
rt 180
' _8 b0 h6 N0 ]8 C. mfd random-float step-size
4 \" T j* U A* X6 @4 davoid-walls
& w) y4 Y' C3 d. l8 _! K- aset stopped? false]
0 N Z- [: A7 ^* `- k4 T[set stopped? true] : |" |% ]4 ]1 I. ?! O8 b
] |
|