|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false
" k2 Y& C1 q+ L) K) X& Oto go; Z- `7 W* z5 S) L# a" Q# A
if not any? turtles with [not stopped? ] [ stop ] . L1 N; C/ _+ m" a
ask turtles with [remainder who 5 = 0] [
: J9 ^, x6 x" L3 g- ?8 W* Yset close-mates (turtles with [self != myself])with[) j% ?( l$ o- y+ \2 Z
(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) , |: N/ Y% x7 a0 }% F
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep )
3 D. n6 j$ y, I; a. Rand remainder who 5 = 0 $ v1 `, ~* r. a
] " h' g) _9 X0 ?
ifelse any? close-mates
" p7 N% }$ [; b+ [6 u. S' ~[
! E9 z+ L/ ^: v3 ^set closest-one min-one-of (close-mates with[self != myself] )[distance myself]4 G2 s$ e- q" m A
face closest-one, v% [9 O5 B) T7 M1 r1 D/ ^% \; _
rt 1809 o# t! K* @7 ?! L+ z- {4 U
fd random-float step-size
1 g0 p" [+ a6 U$ G6 f, O2 r Wavoid-walls0 ?+ W9 Y/ \+ W" }' V* d
set stopped? false]
2 }6 {* m+ F5 N; e5 ?[set stopped? true]
# L% c0 }+ n# O7 ~& g] |
|