|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false, g* Q8 q {0 S6 }1 E* G
to go1 m' w7 N3 m9 E
if not any? turtles with [not stopped? ] [ stop ] 0 r- W) p: w/ D) _
ask turtles with [remainder who 5 = 0] [
- S4 F) x; h9 ?% \2 I# ~4 K% ~set close-mates (turtles with [self != myself])with[
# E2 ]$ a) \2 s V% i F(abs(xcor -(xcor-of myself)) < X-Dist + Wid )
, V$ Y/ T, ~( nand (abs(ycor -(ycor-of myself)) < Y-Dist + Dep )
# y1 m* b7 L6 S- q* mand remainder who 5 = 0 2 b; H( d3 A+ ^6 u
] . c5 w: f: C& E d
ifelse any? close-mates 8 d M: f; Y" R4 B4 j8 e
[ / S0 c! f0 i: N. @! s6 b. v
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]) i# D9 I) u& P' G5 z
face closest-one
8 ?' z' l1 M0 X: Y3 o Lrt 1801 L8 ~" A3 X; \! X, r6 P, Z
fd random-float step-size
. z9 R1 t4 M+ B; xavoid-walls/ x9 y; e, O$ M, C& x4 ~4 s
set stopped? false]# o2 ]4 b0 x3 J( b3 Z
[set stopped? true]
" `5 k+ p- J) y( d] |
|