|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false
0 b; h, \% r |" @, F% n! H, o- O, hto go
- U3 |; Z# [ a+ J' Xif not any? turtles with [not stopped? ] [ stop ]
2 u: _- \' h1 J6 mask turtles with [remainder who 5 = 0] [
7 m% x( E+ Q6 @set close-mates (turtles with [self != myself])with[
l% n2 l* j' k8 J7 W& z) @(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) + q* ?$ M" L0 A( o) u
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep )
7 n. }/ Z* X( ?" L$ S. X- zand remainder who 5 = 0 6 f& m( Y2 ^$ `. M4 W; K( m
] 4 l3 T- q8 h/ p4 I
ifelse any? close-mates
9 o( S4 u1 x3 ]- s[ - h* a o: p) h& m- B( e" H, J
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]
y/ ]% G0 {: |) Oface closest-one
/ }( {7 |0 ~+ u8 A1 @% ?0 Grt 180
- a/ K3 N3 M. c' M0 B+ k" S" t4 pfd random-float step-size
9 _0 G# b7 R( |8 s. Javoid-walls# u5 y0 F/ J0 w4 {# t. }
set stopped? false]
$ n& P M- N( M) r[set stopped? true] 3 ^" c' |8 U; X6 A! S
] |
|