|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false' Q( l. ]4 i7 S) y$ D9 Y
to go
' e4 A0 r- j. V& \" qif not any? turtles with [not stopped? ] [ stop ] $ @9 v/ f9 V: `, s2 z0 v9 _
ask turtles with [remainder who 5 = 0] [, `" I! V% w$ S/ k$ y7 ~( p' j
set close-mates (turtles with [self != myself])with[
# S' {& n+ {7 j' }(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) . {) i7 C/ [6 i3 h1 c; ^/ q# D
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep )
) q3 z2 D5 g4 G0 w6 g) u- y; K+ Band remainder who 5 = 0 ' |7 w: ^, D, T' p3 @9 J; f
]
3 B; p# c9 _ v5 I, pifelse any? close-mates
- d' r5 m& b1 E4 ]( u n" ][ . p( E! t2 k- Y: Z# B+ E: \# B
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]' X0 F& ?0 y) A
face closest-one
6 |- C; m% x/ \: grt 180
% Z) z. H8 \ e( x4 Kfd random-float step-size
5 [; W1 O# i$ h* f* a0 O: x" vavoid-walls; ~5 `4 }& h" T3 Z% _& T! Q
set stopped? false]
1 t6 T) u0 e# |9 E; t[set stopped? true]
4 V* m T- Z& u] |
|