|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false
0 o2 h+ _' O# y4 E8 |+ s9 W* yto go5 |7 V; ~, t5 s4 }+ s5 j- v
if not any? turtles with [not stopped? ] [ stop ]
0 ^+ a. K. B6 e+ f# z) p! Kask turtles with [remainder who 5 = 0] [, v4 h/ m: g0 g
set close-mates (turtles with [self != myself])with[/ R* I0 G0 d5 m4 `) W/ v" i, O
(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) $ e9 t3 Q: ]) N/ s
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep )
, R! M. Y" W5 Xand remainder who 5 = 0 ; A6 P" t T1 k) G2 A+ K, `
] - |" C8 u/ h8 A0 c. C* A
ifelse any? close-mates
Q) D0 f. x4 o. G4 a- r7 [[ 4 u6 c- ^9 O i* ~! E
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]
; F$ m/ l: o! a, J" iface closest-one; H* g8 h" [" P7 o% N9 r5 [; N
rt 180
Y4 G& z" l* k. efd random-float step-size
" T4 X# [9 ^4 ravoid-walls
2 U. l: a, A1 O+ y; Oset stopped? false]
/ k# l2 S& R, o4 X$ N0 M[set stopped? true] 8 |& f& s& ~1 s4 u6 x
] |
|