|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false
& j5 }( U1 N. m2 ?8 ?% vto go
2 b$ j- s( ~, G# I, zif not any? turtles with [not stopped? ] [ stop ] # w/ J& c- c* d2 c! X) P
ask turtles with [remainder who 5 = 0] [
6 N% j7 G* `* S$ h# p' m Y) ?2 fset close-mates (turtles with [self != myself])with[
& r/ l$ e/ M, ?+ f6 b( g(abs(xcor -(xcor-of myself)) < X-Dist + Wid )
, G2 `) g; Y/ Hand (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) $ G( C/ [" G! M; g
and remainder who 5 = 0 " _$ A( N4 E2 n3 f7 S [+ ]
]
' w) \( Q1 F& P( A1 b2 Fifelse any? close-mates $ [* [ \, J5 ?4 _; X3 E) R
[ 2 _6 y2 I% t' C3 e5 u* C# U2 N
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]
9 ?( A5 H- w1 J0 {; X2 K8 kface closest-one
: q9 j. \. ]1 x( v* q" ort 180& X3 @9 c( w5 h5 x1 [
fd random-float step-size
J' |3 g2 U W/ W; l! Iavoid-walls
! l. ~. m: a+ o0 c, Jset stopped? false]
1 ] V4 `. d- \: N' G9 t: j[set stopped? true]
/ T$ a) q+ k# T6 M# W] |
|