|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false
+ k: T' f4 O: R w+ y" U( d3 oto go
$ D# [7 Q" M6 O% f" wif not any? turtles with [not stopped? ] [ stop ] 9 i, [. A! R6 ~# n
ask turtles with [remainder who 5 = 0] [) \ g' M M1 R5 `, Q2 ?$ d$ _9 W
set close-mates (turtles with [self != myself])with[
1 h! p3 v, v+ }; Z# f1 ?5 v+ K' x4 W(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) 8 n7 V7 Z4 N T
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) 1 Q. V& ?, x5 d$ U1 U
and remainder who 5 = 0 7 L# R) w( [# M) B
]
% H4 `% t' q1 d( X8 Tifelse any? close-mates U3 \, q0 {; m9 }7 I" }0 v. B9 G8 J
[ 7 K4 b4 \0 v2 P
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]
8 ~0 q, X0 x/ V# c- q( Oface closest-one
' j P1 ^3 y6 J2 T6 \ frt 180
; c' ], Q- S2 H" f3 a* t: l; vfd random-float step-size
3 X% P0 I5 t. p8 l% F9 w7 Javoid-walls
2 e i1 _. m( X; g% bset stopped? false]
( Q2 v4 g r2 g E4 x U[set stopped? true] # P' g. f2 Q& H" i, D% V
] |
|