|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false$ `) @! k$ O) `/ |" \4 g
to go
1 q, N, M e1 U( G/ z* F: a9 D/ D3 Vif not any? turtles with [not stopped? ] [ stop ] 0 F, H8 \% e7 H" [5 Y( w' C K5 U2 V
ask turtles with [remainder who 5 = 0] [
: L, g p- L. |! V9 i; w6 N% E9 sset close-mates (turtles with [self != myself])with[
# U6 c9 n" f) I0 k2 f* x1 W2 G(abs(xcor -(xcor-of myself)) < X-Dist + Wid )
; s) x( ?2 X) t# {; C4 t+ ^and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep )
4 p$ A$ f: D1 `1 hand remainder who 5 = 0
4 M' _+ p5 k7 j- w+ G] ( q" `1 x" ~& j# i; i
ifelse any? close-mates $ S* N: i& k- S( Q2 `
[ 2 V$ ~& c& }3 a9 Q! G9 W4 F
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]
& D% i- X+ o( @face closest-one
x: J. \8 i/ F* c4 X: jrt 180
R! y) i( N" Lfd random-float step-size
) N: P: `+ {' ]$ a8 Davoid-walls G7 z& T* T' d8 c
set stopped? false]
. K; K3 B* U: q7 d3 O[set stopped? true] $ C5 k, O f: |
] |
|