请问:
' e. K. y2 q+ l3 U; H/ B$ ]随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?" [& o0 f8 L8 A% W+ x4 [7 n# I& a y
$ w0 O( C) e; i2 A
1 O& t) G" |* x8 p
turtles-own [ energy ]6 M# C' d+ C2 C1 r- \
to setup
. V) C1 s; Q8 r$ s, Q1 Q; R0 lclear-all
* A8 r1 V: ]9 m/ p! V2 h: d( x1 Oset-default-shape turtles "square"
! W3 k7 A2 y3 k& Q. o, W: Qcrt nutrition3 y" R( G1 ~% n q- _2 I9 c
ask turtles[
* n# Q0 j W2 v set color white
3 h. I U9 n. d! E0 t$ ? setxy random-pxcor random-pycor]" R V" l0 a4 }
( D2 K2 _. J# B: ]* U+ [. Q
ask n-of microbes-initialization patches7 b' Q& r4 T+ H' `; c
[ set pcolor green]
+ b0 I! d2 p L+ N8 I0 V ask turtles [set energy 1]
( Q% ^7 E `& y, Z5 mend* p) E1 s; g& v6 y
# K- _8 q; Z: f' P0 {! f, m8 X
to go0 }2 @3 r4 O) d3 X- u1 l
ask turtles [set heading 90 * random 4 fd 1]% R" W6 T0 o2 `) j
ask patches with [ any? turtles-here]0 K' T; \6 h# G! S
[ if pcolor = green and random 100 < chance-of-congregating [tt ]]
3 ^$ ?5 r& ?! e5 y ask turtles [ if energy = 0 [die ]]
( G: m- E# z: ?0 y, o3 P end) F) p+ Q* @1 F M; r: S
- ]3 ?3 N6 ]8 R* s/ c3 q9 E2 hto tt) K3 L$ a, d* u0 R! }" M
ask patches [set pcolor gray ]- B! Z7 c$ U" O1 f* M% p, F# t. `( a7 |
ask turtles [set energy energy - 1]4 T0 ~8 v/ e5 h: i
end3 {& z# f }1 C, C# [) X3 D2 {* R
" R5 l. A1 X+ [
|