|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false
- J9 H2 s% ?6 W3 W0 ato go2 U, P2 S8 U! \ o: g% j4 V. d+ i
if not any? turtles with [not stopped? ] [ stop ]
1 y: D$ H+ }0 e% x' M" v& |ask turtles with [remainder who 5 = 0] [
+ n' ?) [; O) C8 \4 a. q; T% Iset close-mates (turtles with [self != myself])with[
6 F4 [) u* R2 p8 [* x* [* I' ~; g(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) ) L( F I' F9 E7 o |0 Y' {
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep )
x7 g4 d8 X, [& ` I7 t( T Cand remainder who 5 = 0 ! u& D4 H. D6 c& Y7 E i2 a% k1 X
] : v/ L& u/ q! ~# E7 x$ y
ifelse any? close-mates
2 Z/ X. p I1 W' n2 f. V[ ! C" H! c$ A% j& L! ]
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]
; t& a( o# L! I2 h. K& wface closest-one0 x% x7 f5 h( J8 c( n
rt 1804 z2 W& S( h5 H3 O* k
fd random-float step-size
, v7 ]$ S! p; J' Davoid-walls( x/ s) ]7 r. s1 q/ M: q
set stopped? false]) f8 ^* o/ I) s, x' g2 V2 |& t
[set stopped? true] 3 n3 n1 U" ]8 i5 {- A; A
] |
|