请问:
1 V6 G- t/ F0 U6 h随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?
: N+ r4 {# ~' c8 |' N. V5 t; g4 C3 z: Y! h( \% }6 d' U
3 Q7 E, Q7 N, f, z3 W# `turtles-own [ energy ]1 j6 e' V7 k$ Q
to setup& B: [' x- U0 |3 _0 |4 K3 V
clear-all8 S* ?: K3 |7 R# c, k- [7 Q
set-default-shape turtles "square"( o8 ]" G8 E" Y, |5 W
crt nutrition
( k* i# w8 l* ]ask turtles[( I) c/ e0 V/ s7 I0 b$ m9 D" U
set color white
P( U5 q$ a* p1 w setxy random-pxcor random-pycor]/ W, W$ s0 X6 v0 E4 X/ L. Q
3 C( \0 \1 x, D3 P4 qask n-of microbes-initialization patches% L7 \# D8 r* m( N( l' C" O
[ set pcolor green]5 m( f0 K2 D9 o1 n
ask turtles [set energy 1]. \' G0 A7 N% y- E0 L
end' G. K* j* E$ c, T
9 e; e$ m# |2 K1 sto go3 i7 g# Q9 [8 B; v% n9 i3 V
ask turtles [set heading 90 * random 4 fd 1]) {4 ~4 E. N5 l* ~8 Z y9 w
ask patches with [ any? turtles-here]
- R- F' Z$ d; S2 k [ if pcolor = green and random 100 < chance-of-congregating [tt ]]
z7 ?9 L7 j' b; E5 C5 r ask turtles [ if energy = 0 [die ]]
* h. w, t" J" y* N x- q n end
6 X1 j) |3 D1 T5 k1 n7 j' T" }% K
to tt
2 g* E/ |* h) _: d+ f. |ask patches [set pcolor gray ]2 I: I9 o# i6 n
ask turtles [set energy energy - 1]
' N) ~& x$ y' h: t; Mend
/ Y' e6 A& s+ j% s, o9 B/ H1 {; U( d9 l. j" d5 Y9 [
|