|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false* i5 |. m( T) V$ |( s) f, ^
to go! K/ I0 c3 C$ s. r. l' W, D: o
if not any? turtles with [not stopped? ] [ stop ] 0 t1 y9 M# f3 \
ask turtles with [remainder who 5 = 0] [
' |2 ?, k8 {$ C) iset close-mates (turtles with [self != myself])with[
6 k1 x# [' G$ ]0 Q# C8 b( g2 T(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) / s7 f# I& ^; I7 H `
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) . F7 H: Q, d# s2 L( @. d% j w1 q
and remainder who 5 = 0 _% I9 @$ S8 a; m0 z5 x: c l
]
9 h- j" ]5 Z4 Difelse any? close-mates
2 @' ^9 S! e) Z( ?4 X9 |! l- g[
' F1 s, e% J6 ~. ~' r" v% Bset closest-one min-one-of (close-mates with[self != myself] )[distance myself]
H4 ?; ^% ], ?# f: _9 N" j" Lface closest-one1 l* B7 C% U- n" N0 j, L1 @
rt 180. U6 Y7 C4 |, P, @
fd random-float step-size) R Z5 G4 e/ z0 w; L- f
avoid-walls
6 z! k/ K2 m# n% K: A' Z5 i& Gset stopped? false]
9 u. @* e3 A: c( L[set stopped? true]
) q h- Q* H0 E0 l4 M" I] |
|