|
|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false
& y1 v' ~+ m% w& Q# qto go* B+ S+ g$ q8 Z. H+ R8 w2 _9 V
if not any? turtles with [not stopped? ] [ stop ]
& c8 h" F/ v5 e7 W4 x' d; F" Cask turtles with [remainder who 5 = 0] [
$ m* v) p2 I3 g/ R2 I. wset close-mates (turtles with [self != myself])with[
. e' M+ t S! |4 [) I- r( I! ^, Q(abs(xcor -(xcor-of myself)) < X-Dist + Wid )
9 B) |9 ]2 ^* t7 W0 hand (abs(ycor -(ycor-of myself)) < Y-Dist + Dep )
2 \1 t% Q# g7 j3 ?7 |; Jand remainder who 5 = 0 # t* f2 s" s$ w4 v. g7 D
] 7 y! k; s% o0 E& U4 b& I: Y
ifelse any? close-mates
4 s! F* X( d" B5 W6 Z n, ^9 J[
' H& U4 ^6 _ _- E v/ uset closest-one min-one-of (close-mates with[self != myself] )[distance myself]+ d" O/ Y& z; ~& Q
face closest-one/ ^$ x% ?* L0 ~/ m6 n
rt 180" \3 p" P3 q7 h, Y" |
fd random-float step-size9 A j, Y \2 j1 `
avoid-walls2 @( O8 b. n% P
set stopped? false]6 k: ]6 y0 o( J% m
[set stopped? true]
' f, m0 W5 z, @, b5 |- ]] |
|