|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false
9 @/ d! f' e- K2 L+ l: k* Nto go
4 P) U9 r. d, T% Qif not any? turtles with [not stopped? ] [ stop ] 1 Q1 Q( J2 t q" T7 J9 u6 }! D
ask turtles with [remainder who 5 = 0] [
7 `8 g* K+ w8 k7 y$ Hset close-mates (turtles with [self != myself])with[! P. ~2 e! U' }% A5 w8 {& l4 D O4 y
(abs(xcor -(xcor-of myself)) < X-Dist + Wid )
& U ?& ?+ Q! O# {0 hand (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) 1 s$ L b& Q1 V |: ^9 I) c1 m
and remainder who 5 = 0
9 J8 k3 u6 x) g; U6 N] 3 U. N0 I( W6 G9 s
ifelse any? close-mates - H+ n5 v4 Z' [ d+ U I8 B
[ 6 D+ } \) a0 I! z
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]
1 s5 G6 w, {1 S8 fface closest-one
; y: N+ ~, v9 B# D& ort 180
4 @3 r7 o, C' e f9 Z& @fd random-float step-size
! e: H! ~$ k) A- n# x: Havoid-walls$ v$ @) L1 y% A" F
set stopped? false]
+ C4 r9 {2 v/ Q& y+ m, p. E( S[set stopped? true] ' t& q2 U1 ~8 B1 |+ Y2 Z
] |
|