|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false4 I% m! x' b; c7 F( Z% a3 T$ N m1 t
to go* z$ c9 n8 B! }, B
if not any? turtles with [not stopped? ] [ stop ]
( H/ r8 D2 a3 v3 s- Vask turtles with [remainder who 5 = 0] [
! ?6 }) D! G g3 mset close-mates (turtles with [self != myself])with[
) t: F" L7 U) p% C& j, w6 l(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) / a3 A4 W- Z3 o
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) & n3 x* i# t7 }3 f& m
and remainder who 5 = 0 3 n0 Z; ]4 V9 \& Z
] " n7 e3 R" S" r
ifelse any? close-mates , Q; O, q: H. R
[ 7 W B$ A! N. b/ L; m% F
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]
; ^7 {( S" R) p$ D* Gface closest-one
6 {# E/ K0 u- w8 w, Vrt 180
# i/ g' h) E9 k: ffd random-float step-size
4 v" F2 r6 x2 {: d3 wavoid-walls
3 I' c k) {6 D9 @7 u9 yset stopped? false]1 i8 y0 {, }. Q o
[set stopped? true] + S: a6 {( P: R
] |
|