|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false
, q# D) }7 D' o% Wto go
8 M! ?0 l+ X2 P( Mif not any? turtles with [not stopped? ] [ stop ]
7 B# C, ^+ A6 y( v, N. Uask turtles with [remainder who 5 = 0] [
4 v1 ]/ H4 ~, g" }: o7 uset close-mates (turtles with [self != myself])with[" W$ b! o% H9 F& E0 n1 ~
(abs(xcor -(xcor-of myself)) < X-Dist + Wid )
6 Z4 d8 d4 o9 oand (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) 7 H+ y4 E: U* f$ N- q% `- F; S5 }
and remainder who 5 = 0 $ a- R& n u: _7 J0 [) j$ X
]
2 u) r2 Q: d+ n0 Uifelse any? close-mates % M E; j' L j; I. l
[ / n- r* V4 F/ U1 M8 I8 [8 Y, D
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]9 |6 `2 u1 u" q# c" U- h8 }5 M, a
face closest-one) `: R. o7 f; O' R" g6 z; W& O
rt 1808 w! T4 l. I! T- c& r& w
fd random-float step-size
* ]- ~' T8 l* M# \2 T2 r. Davoid-walls; `" u* ?! N- f# t9 W4 _# C7 y
set stopped? false]1 O8 g* s" [6 b. |8 y, C0 |+ X8 I
[set stopped? true]
- l* ^/ F6 e$ u) {] |
|