|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false m' r" t) T2 e
to go* \" |. g% m$ ?
if not any? turtles with [not stopped? ] [ stop ] $ l1 i$ ~( j9 c9 r+ Y% o
ask turtles with [remainder who 5 = 0] [
! ~# Y8 Z3 y- X: i: k5 Dset close-mates (turtles with [self != myself])with[" D6 _# ]$ S! F" D [* h6 t8 \
(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) 7 |: b8 F7 i6 w" \' R7 V
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) " P7 C2 \+ A9 E: ^! _
and remainder who 5 = 0
0 n# n1 ?/ {0 X: v% U( v] - ^" V2 W8 s' j3 f$ h) j a
ifelse any? close-mates
+ V* T# @; _5 z, q7 E[
2 O' J; m# r+ [" B( v. ~, M$ \set closest-one min-one-of (close-mates with[self != myself] )[distance myself] c W+ o4 Y. `8 H5 u* @. u
face closest-one
3 g: m7 f: K- }! e/ L; Urt 1807 U1 k% C7 m2 ]7 _' g% t. \0 k% W
fd random-float step-size
, n/ X$ Q6 A" q" d9 n; J! l |$ xavoid-walls" B3 i) [5 U3 U8 U# l5 { ]
set stopped? false]
& ?9 y! V- \* h! B0 Y[set stopped? true] + Q9 w7 j- c0 }5 f1 G" N5 ~
] |
|