|
在这段代码中我设定了一个stopped?变量,初始状态设为false 。运行过程不能输出stopped?为true 。始终为false: a O0 f- c6 U" Z! Q& b9 r1 q3 Z
to go
# E+ G( [7 J1 v( B" iif not any? turtles with [not stopped? ] [ stop ] ) n, F' e9 Y6 r& R
ask turtles with [remainder who 5 = 0] [5 Q' c$ p8 n- a+ y; X4 I( i
set close-mates (turtles with [self != myself])with[
$ m( D1 t* k9 W# x- y/ C(abs(xcor -(xcor-of myself)) < X-Dist + Wid )
- \ S ?- T! l1 f2 r8 E/ {) mand (abs(ycor -(ycor-of myself)) < Y-Dist + Dep ) $ V: d- T4 t: i; D$ w& l
and remainder who 5 = 0 8 ?) P1 j0 M! ^! o6 ?) M
] $ o4 R; |8 D- S+ D/ }
ifelse any? close-mates
' \9 p( Z0 h4 U% X3 [[ ; }# ?" O9 o [2 l' D, E' u2 a
set closest-one min-one-of (close-mates with[self != myself] )[distance myself]
8 v. o" n6 M9 M7 Y6 Sface closest-one
4 a: q8 P s- G) T) Drt 180) j# `) T$ K9 w2 M2 [7 {
fd random-float step-size
& r {) [( X$ L- n" V9 {3 S: W) wavoid-walls
5 p- w! p4 C' t& bset stopped? false]
; \8 @! _. W+ G! B[set stopped? true]
% a# ^$ ^: I8 A* p" [8 f6 ^, ^& @] |
|