|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false
2 _) g [8 k* h- n* F+ hto go* ~5 J4 k- ]% O+ h) p
if not any? turtles with [not stopped? ] [ stop ]
2 k# k1 i( y# O/ b/ E. `ask turtles with [remainder who 5 = 0] [& u' [! @( R. W
set close-mates (turtles with [self != myself])with[
9 [# \5 D" G+ `% ~8 k v) B(abs(xcor -(xcor-of myself)) < X-Dist + Wid )
, f0 |- B8 M. r2 w7 Hand (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) 2 f8 m3 \8 H5 w2 b9 M, C7 I
and remainder who 5 = 0
5 M$ m9 H4 p; _0 I# b/ W T/ ~]
- {/ I, j* } B: Tifelse any? close-mates ! e3 B. X" `/ S x' g. w0 j1 l
[
$ `# F# i0 |) ]1 N( A1 Wset closest-one min-one-of (close-mates with[self != myself] )[distance myself]" \$ e2 ^- S% c5 [1 B# C7 m
face closest-one1 d# H* f& B4 Y% w7 p) `! K
rt 180' ^7 t) V$ ^+ q) c
fd random-float step-size
B' `0 d' h6 e0 _' gavoid-walls
3 U1 p# s! m7 m" u& Pset stopped? false]+ s- V0 l" x7 B: D1 p W! k
[set stopped? true] ) T4 d0 x, A2 q3 h: M
] |
|