|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false5 c, F; A4 w8 w7 ? n
to go) G% J. F3 e+ k
if not any? turtles with [not stopped? ] [ stop ]
. R0 c0 k' a# y: Oask turtles with [remainder who 5 = 0] [, \0 b9 [0 ], n9 f* P
set close-mates (turtles with [self != myself])with[- j, N# M9 l8 y- e' h7 b
(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) : f. G7 ]0 z: m
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) ( s+ B* s; M- N* o# ?
and remainder who 5 = 0 o' d. n6 n+ ]5 \
] $ l% b- z# N6 S' I% z2 f
ifelse any? close-mates ( I: ~* [" q% W: d
[ # v. P V4 \2 f: l2 e
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]
2 ? o# t3 @; @) q/ l. \/ `face closest-one
( O5 }- l' X2 C+ Z: H# wrt 180
( F6 t' }* l) C0 xfd random-float step-size
5 ~: s2 n' K, q% R$ tavoid-walls
4 O& F! ~7 |# r" t( v8 i* f. s( mset stopped? false]8 W3 A/ V2 l( B
[set stopped? true] $ t$ ]# G" i7 H. x3 e2 [ S
] |
|