|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false7 [0 Z7 B& L1 q4 L2 N
to go
$ Y P7 n# M/ cif not any? turtles with [not stopped? ] [ stop ]
. k, j/ t8 y8 ~7 P) g+ d# bask turtles with [remainder who 5 = 0] [( n# K H& U" L9 x8 m) r6 k" f1 \
set close-mates (turtles with [self != myself])with[, V% { |$ T1 k0 G( y
(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) + d$ ^! ? d q5 C& n8 l$ E& B
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) , s$ i+ Q, E3 B* B
and remainder who 5 = 0
( ^! L' V7 e: i' t% t1 a]
, x9 S* t) I B6 @ E4 Bifelse any? close-mates
+ S. K$ I) n4 w) `9 ]1 _2 D[ - |4 ]% U2 {9 Y' N) V+ i
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]
) h0 e- a9 l* H/ p, O1 sface closest-one5 c7 ~7 l' L" t0 V! B, Q: B7 e
rt 1800 Y6 u6 z! V3 y3 R/ _& S2 `( @
fd random-float step-size
5 I a" \4 |4 i3 p8 Cavoid-walls! B7 C- o* z- K
set stopped? false]- D0 V; s# y$ f; @+ v
[set stopped? true] 8 Z$ d& A- P( r c- @# X' a* z
] |
|