请问:5 L# I$ x2 H# _0 E. u
随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?* C8 y2 E: U2 l C
; A+ y# x% r0 T# C [- M7 t5 T4 V8 W
turtles-own [ energy ]/ p. N8 ]! }8 h; d
to setup
7 y& n# f: b1 o( G5 r% Fclear-all
" B6 h& ~& l' f8 s+ E/ Sset-default-shape turtles "square"4 J, K- p7 [) O6 ^3 k9 q
crt nutrition6 I/ `+ r, w; j4 \, D4 _* A% E
ask turtles[
4 \. p! [; J- c4 K set color white$ M' c& l* v8 |& B# A# A
setxy random-pxcor random-pycor]
9 H R& M5 D1 M2 J6 c- b* H
& ~& S8 X# H# w$ ]ask n-of microbes-initialization patches$ Y# |+ z _6 G* t+ y/ f
[ set pcolor green]( w% P7 D9 b4 ^, O4 u
ask turtles [set energy 1]
0 M0 R5 p+ P0 q, S3 Gend7 M0 I6 [) M% H3 `/ }( M0 `
* T! l" b8 ~3 d9 J
to go
3 G! l1 J3 h) `4 k# d: u" d ask turtles [set heading 90 * random 4 fd 1]
/ E/ B9 ?: k# X9 P. G+ o ask patches with [ any? turtles-here]% h# P( \) S* H# R5 T1 A
[ if pcolor = green and random 100 < chance-of-congregating [tt ]]
# @, \. g" q! l3 m$ I ask turtles [ if energy = 0 [die ]]
* N3 l- |- ^5 b+ h9 v n e9 z end# J7 s; T/ p1 ~+ d) A
; x$ X2 G0 e' W( q0 O$ i3 @
to tt5 @- A! j W3 H# J0 k. d$ v
ask patches [set pcolor gray ]
# C& G" h% S$ s8 eask turtles [set energy energy - 1]0 ^, ^! E( Y' B8 M3 R, Z
end j9 S& X F$ q; I! t& g/ l
0 k2 @! B* U4 M( N |