请问:
) y) a; f, A. X _, M) D随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?( h3 X9 ]. A# k0 y8 t: A1 u' s
" N5 }# P+ n5 Y6 h7 n
: D. J) i; ~# ~* k. kturtles-own [ energy ]/ Z! g/ a F! d+ A* o. ~0 _
to setup
* l: L7 o2 A! w0 q" w& A* @clear-all
& ~6 I% l9 p4 g6 V6 J; hset-default-shape turtles "square"
# @0 p+ K! ?( s, ncrt nutrition
8 E# z& \1 f' J* Y' T9 { Z7 Task turtles[0 O9 d+ k: X% _
set color white: N/ P8 C1 D, {$ u0 {2 ]
setxy random-pxcor random-pycor]( k4 s$ f: ?& \' A5 m, ~: ~
8 s+ m" v/ t; rask n-of microbes-initialization patches
; Y8 }% U; f6 i5 E/ a, f [ set pcolor green], h K4 R! p# x2 P0 E9 S
ask turtles [set energy 1]$ D4 m O5 [, |$ h* H8 k1 o/ A
end. o! Z! f* p- E4 j' N c% c
* D% S1 o& O/ ^/ x
to go$ M4 {2 v( [. H$ B! u! a7 ?
ask turtles [set heading 90 * random 4 fd 1]
: G7 b: ?( O5 X! z, M6 ^. R* \ ask patches with [ any? turtles-here] a# {5 o, _" n+ `7 f" r; e
[ if pcolor = green and random 100 < chance-of-congregating [tt ]]' _4 F( S* p7 B2 ?
ask turtles [ if energy = 0 [die ]]
2 A b0 l. Z, }. Q) q( Y0 {1 r- s6 } end& r* E0 N& y! J' o1 s: [/ H- v
+ _" [: G7 |3 j4 W" B2 q; F* x+ `to tt
* N% t. ]) m; h" w Bask patches [set pcolor gray ]( f9 W5 v3 N. V& I
ask turtles [set energy energy - 1]
7 r$ f1 m3 a! K2 b; Pend
1 a: M. @+ N" k' M- R' q# J. h
5 y" L- w' [" g7 c |