|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false
1 j7 ]& D& `# S. P z: tto go
+ z* _% ]* l L8 {- }3 m# qif not any? turtles with [not stopped? ] [ stop ] ( ^9 H# V4 y; g' i8 z
ask turtles with [remainder who 5 = 0] [
, |5 Z4 u5 T9 b6 ]3 U& Eset close-mates (turtles with [self != myself])with[
( {, O d1 j8 b7 X& p(abs(xcor -(xcor-of myself)) < X-Dist + Wid ) / X8 e2 S: a0 u b( q
and (abs(ycor -(ycor-of myself)) < Y-Dist + Dep )
3 c4 y# c s. _: ~and remainder who 5 = 0 8 U& ?9 p, r7 B5 r9 A- n
]
, G; \, l6 v# ~: yifelse any? close-mates
" b5 P' F+ |: {5 F[
5 P2 O6 E. W0 ] Iset closest-one min-one-of (close-mates with[self != myself] )[distance myself]
/ ]0 P# `* }$ V9 ]% u& @# ~face closest-one1 U+ k" S* x2 ]
rt 1804 J1 w1 G7 @2 X6 Q
fd random-float step-size
0 {7 |6 o, ]( [! s0 mavoid-walls
6 z } a3 \9 w$ q. L0 b% N/ |set stopped? false]7 o& F( ~ g9 \: X( d3 @
[set stopped? true]
3 v5 T7 h3 a% |/ @+ X4 i0 ^] |
|