|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false; s, B- O, D( ?; ~% r
to go9 K7 B0 I0 n1 s; p1 Z3 _
if not any? turtles with [not stopped? ] [ stop ] ) H9 L! t# P$ q+ n
ask turtles with [remainder who 5 = 0] [" N% [+ ?+ m6 n
set close-mates (turtles with [self != myself])with[
. n0 w6 Q3 d9 a7 r0 M' H2 I(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) ) B! H5 C% Z# R, A& Y- D
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) : i; E; E0 @1 `# V
and remainder who 5 = 0
. B: P% @! g w/ d6 F7 ^# z4 h1 n]
6 V5 Z' d: N* ]/ ^2 I5 _ifelse any? close-mates
Z2 r7 a- F3 X6 g. W[
" ~% j. @# l; c4 l* s9 {set closest-one min-one-of (close-mates with[self != myself] )[distance myself]
$ P+ L+ \# A- b+ c5 Zface closest-one
$ v+ U. \$ S( d V0 S. srt 1800 O, a4 r }1 L. r+ N
fd random-float step-size* w2 j$ L( a% y/ P1 ]9 T( d9 F
avoid-walls$ p$ @7 n1 s+ g% ^" C* J! X. z v
set stopped? false]' U$ ? S( n4 S& c1 n9 {
[set stopped? true]
# Y0 V' ^0 J3 x" L( W] |
|