请问:
. T8 g1 \/ j+ b' {随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?' m3 G+ [7 p# W) N( n
1 z' s# n# ^% j( p0 V& v6 p
% ^- v. P9 i/ R' r! Z2 Q$ D
turtles-own [ energy ]/ J9 X# D5 _) {# T
to setup
, R3 l k' A+ x6 `' Wclear-all
4 f, t/ C6 y+ ~9 aset-default-shape turtles "square"
- ?1 v9 Z3 C1 U0 s9 tcrt nutrition9 [0 N9 x( j/ D0 i
ask turtles[' U* P4 a3 z% A; |- L
set color white! K' B1 e; e/ }5 P0 u z" b
setxy random-pxcor random-pycor]
2 U l. w) }4 G* R4 N ~6 X
2 {/ ?- W7 x# ^5 X; d9 Zask n-of microbes-initialization patches4 y/ f8 f( T4 S. O* J* Y
[ set pcolor green] x% @! N7 t8 k$ j0 x5 a0 G$ w
ask turtles [set energy 1]* I3 m# Q7 n! y a1 v; u
end
) L% T( N! |2 T( o1 r7 t9 j: o
1 Y5 `6 Z0 P9 y/ X8 \2 Eto go; O% c/ E' Q5 E+ t* O
ask turtles [set heading 90 * random 4 fd 1]" ^6 R: E' t; A4 k& o9 z; O( r
ask patches with [ any? turtles-here]
5 |8 @* U# q: `4 T' G! U [ if pcolor = green and random 100 < chance-of-congregating [tt ]]# `: {1 k k9 u5 X, s
ask turtles [ if energy = 0 [die ]]4 E7 s2 k, V: F
end
$ s& M- K/ _8 c; x
V& k) L8 _) `6 G* p- \! _to tt6 j7 a0 E" u J" ]# V6 i }
ask patches [set pcolor gray ] p' L3 w/ H! [; |& p! i
ask turtles [set energy energy - 1]7 x/ b6 N5 Q) \. c# i* {
end, u3 D( d& p7 L: G
6 V9 v5 n9 y- }) |* y& g( O
|