|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false# y8 h1 P4 _6 I
to go. |' _; _% e$ @. k: }
if not any? turtles with [not stopped? ] [ stop ]
4 w4 {% ~/ I: l$ ^! @0 Sask turtles with [remainder who 5 = 0] [
8 [, S/ g, W. j3 g/ U* L1 \; X) bset close-mates (turtles with [self != myself])with[
7 l: G$ T$ M# q( y( h2 c(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) ; K4 O9 O: l/ }0 k- t8 u) {- B
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) 2 |: ?3 a1 o& P
and remainder who 5 = 0 / E. [- a* L8 t2 U) x& D
]
, G/ _ D8 H0 O5 ^' Z3 d! ]3 u" V# Kifelse any? close-mates
& R# C5 A! B' s6 E! B' F' P. H+ C[
2 \' u# A" A: R1 L4 n3 }set closest-one min-one-of (close-mates with[self != myself] )[distance myself]: P5 S! ~8 Q% j5 A$ _6 N3 n
face closest-one
% H% U4 M( J& g; U, G" jrt 180$ E% x* w! d; Q8 i' P& O* U
fd random-float step-size
9 V8 D3 C& I5 n& B) s9 ravoid-walls
; Y2 u' N! C9 b/ I3 Wset stopped? false]
( w' |8 j6 X1 i8 v[set stopped? true]
5 i' q8 x B3 z8 q/ L] |
|