|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false0 ^; Z, a6 g/ @% h. ^) T& e
to go; S; E* t5 i) x; d) a ~
if not any? turtles with [not stopped? ] [ stop ] e3 H) ~- ~' e9 }. p
ask turtles with [remainder who 5 = 0] [
- M- s- X& V4 P0 Q# z" ]- qset close-mates (turtles with [self != myself])with[: w6 R. u" I* L. [
(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) ' B2 l$ P& `3 w$ y1 n( U9 ?) O1 R
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) + n6 j6 ]) T5 _. c* W2 N
and remainder who 5 = 0
! B- A( X: o4 K; L4 c* b1 h] / H! H* c8 n/ ?9 m: K# \9 T; x
ifelse any? close-mates
8 j3 [- S9 P# F3 J$ A[
% I8 w \: a% y- Yset closest-one min-one-of (close-mates with[self != myself] )[distance myself]
8 q8 e- ~; o) ^face closest-one
& z& Q5 x# h/ F3 J( y7 d; G$ I5 Qrt 1800 K7 I( D, b5 W ?
fd random-float step-size
8 m. O- d& o) h: D( vavoid-walls+ Y* n# |, f5 U. A* F
set stopped? false]
2 b; w9 E7 M- S* A[set stopped? true]
8 O7 p& a# h% B( ~' l) L. k" ^$ T] |
|