|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false
3 e g7 X1 u0 y w8 w1 D$ Mto go
0 b5 V. o/ ~3 v: \4 y% T. `; Z3 Zif not any? turtles with [not stopped? ] [ stop ] ; K7 m" m3 ?+ u
ask turtles with [remainder who 5 = 0] [
- M, Y8 R# `* R& ^5 G1 [set close-mates (turtles with [self != myself])with[
8 c. j8 c% N5 X/ t$ j7 x- a$ D' I$ j(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) " |; v- E) G4 s
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) d: c1 z O) L, W$ B
and remainder who 5 = 0 v/ m( U1 N6 ]7 _2 A& b3 u
] * I! ~# M( _& D1 S/ a! L3 ~
ifelse any? close-mates 2 W$ C- ^+ }7 f9 S+ {1 M& f) K
[ 9 [5 [ L4 ?. h/ Y7 {- B. w
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]
1 C, r- I n" @' _1 _* r( Vface closest-one" o* c* ]8 `, b
rt 180
# l* N/ u I: J' d$ E* `fd random-float step-size
$ V6 a9 z; P& C# x" Pavoid-walls1 l8 r! D$ K' `' I1 `$ v0 g8 Q
set stopped? false]0 k8 E6 L) r8 O
[set stopped? true]
4 J% e! @2 o& N* u] |
|