请问:
+ D0 A5 t Y2 \0 t; C( R$ V+ q& D随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?
% ?# x8 p& B0 Q8 e6 S# L# I/ T
( q$ Q9 ^- U2 G, z- D$ F : v6 B0 O) _' G) Q* C/ j
turtles-own [ energy ]* ?. @5 k" }- B; U# Z; o2 L
to setup* i& u% @0 ?3 q: L$ F% C
clear-all( ]( ~" q# ]0 V8 P$ }
set-default-shape turtles "square"$ m1 U" \: v- T( B* ^
crt nutrition
/ |1 G8 D: b9 O+ W" q4 {: ~ask turtles[
) D1 U8 @, z3 v set color white
1 P1 U e' d0 s- f5 \8 J setxy random-pxcor random-pycor]
, v1 Q+ s2 R& a- e( z
; J. D! T9 i# n4 o: p6 }8 g/ lask n-of microbes-initialization patches& B4 C7 r+ H) A. ]8 e p, E
[ set pcolor green]
6 [6 w9 ?' s0 T8 X; \ ask turtles [set energy 1], [7 d/ s1 Z& Z
end
6 k% B; d5 L4 H! ~# H3 _* a
# y/ M1 J" W. w7 r0 Z6 y* K, Sto go, }. p7 l4 X5 \2 ]; K
ask turtles [set heading 90 * random 4 fd 1]( ~: p4 _0 \1 H4 B: `( e
ask patches with [ any? turtles-here]
/ @ |3 X, g8 s0 v8 x% }+ w [ if pcolor = green and random 100 < chance-of-congregating [tt ]]
6 _5 J2 Q1 ?% R' g4 n& c ask turtles [ if energy = 0 [die ]]
6 J, b) \# H0 g2 p$ F end
% K% P& n, _( o) {1 l# I2 ~* }7 B- ]2 {9 l
to tt
+ g1 b- C; Q( task patches [set pcolor gray ]
5 v! ~% r9 Q0 Qask turtles [set energy energy - 1]
! r; S/ w6 r- W6 n5 r$ j% W8 vend; j2 X" S# U2 n8 R- a/ w7 s
! x$ U8 T5 H& A |