|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false. X9 ^ c7 P. P! y9 [0 K
to go* A" C# b1 u. Q& `4 b6 `
if not any? turtles with [not stopped? ] [ stop ] ' P* F1 f n2 O- ?2 Y
ask turtles with [remainder who 5 = 0] [
2 f- v* S- _- [$ m* y! k, q% Cset close-mates (turtles with [self != myself])with[: n+ A* @& h: C
(abs(xcor -(xcor-of myself)) < X-Dist + Wid )
6 y" l/ `: h+ ^4 a0 x. Q0 Y% k9 iand (abs(ycor -(ycor-of myself)) < Y-Dist + Dep )
; m: B8 L* u5 G1 P. e) {and remainder who 5 = 0
. H$ h/ s5 j0 ^" y d2 T* \+ B]
5 c4 a4 B6 E4 Bifelse any? close-mates
; _: A- P* q* [3 @# f/ U4 e[
# S* D4 I9 \* N" G" d& A7 Rset closest-one min-one-of (close-mates with[self != myself] )[distance myself]
/ q( R& I7 w, r2 Wface closest-one
: X" Y0 l( b6 ]" i, \# J# [- art 180. k$ e# [( U' _3 p
fd random-float step-size# o/ N( u8 U* C' W' L: @
avoid-walls
8 D4 M2 d. h k6 U! \set stopped? false]
3 \2 d; ], A- v M: P[set stopped? true] . `/ T- J, ^1 _
] |
|