请问:- q0 u% h; U5 n( s% b* [
随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?/ g) g! @! V% k' |0 U7 q3 i
+ D6 [( c& W# [8 g) ~. |" |
! }4 g2 {, ^" T. Z( ^, uturtles-own [ energy ]6 d* U3 d+ M5 o2 v
to setup
P3 p! ^) S5 ^2 N \2 v4 Y" Eclear-all3 ?1 ?# M) F3 U2 j- J @+ @' U
set-default-shape turtles "square"5 E) E3 O4 d2 z3 W0 f! J
crt nutrition9 X) ]% r; `! y6 K' g$ \8 o7 G
ask turtles[& N+ s( t4 ]" p6 F5 D6 C
set color white1 Q9 z8 Z z) ?/ X
setxy random-pxcor random-pycor]4 z: M& t0 f# s
; L# ^( P( w# L' i. z' B, |ask n-of microbes-initialization patches! \$ z" p6 J( U8 e" n
[ set pcolor green]% }8 H, C0 G" c8 ?
ask turtles [set energy 1]% k/ e% ?# N6 ]) {/ w
end* ]; X1 [' T3 c: A: a
! b4 y& I2 [2 _5 R9 f
to go
! s" T" F ?. Y% Z/ {* c1 a ask turtles [set heading 90 * random 4 fd 1]
, R" W; b# Z, s8 H& U/ g; P ask patches with [ any? turtles-here]0 F/ H L# D. Q! D4 E2 P
[ if pcolor = green and random 100 < chance-of-congregating [tt ]]0 [& c$ V- I# S/ ]
ask turtles [ if energy = 0 [die ]]
W1 f/ J. R: {+ R end
# W9 q# x( L( O) f7 h) J" {. h
8 E* ~. ?) L+ q! d- C0 Pto tt, L% D4 p C; e* [) r: l
ask patches [set pcolor gray ]7 v( a9 e; | r; B$ J6 r, o
ask turtles [set energy energy - 1]4 h3 s6 Z% |* T5 c2 k8 U/ X+ H
end
& A T L; G% R) h, g- @* T2 |0 i! ]
|