请问:
% E2 q" P% d( O1 d u0 h" K随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?* z J" ^; z8 {: `& l
" W% r% r4 C& p" X6 T1 \
8 K) S: s Z& O$ ?turtles-own [ energy ]
0 k0 _3 l6 ^/ ]- j; xto setup& h# H$ E$ F* }$ D" P5 O, J1 R: L
clear-all
) C; A& K. t9 gset-default-shape turtles "square"
: S7 e" O% |! \; g2 D i* J- [: icrt nutrition
# `1 T, y# a* A0 _6 V: J U7 vask turtles[1 ?8 W( Z2 H/ S# R) q
set color white9 E! B( C) B0 c5 [# l& e
setxy random-pxcor random-pycor]
! @2 U8 m* @: h6 [& O* x , ~" m) I8 u# A2 j
ask n-of microbes-initialization patches+ q' v& G/ m: y$ b! Y! g
[ set pcolor green]- o! L6 t4 y8 |; i
ask turtles [set energy 1], e, A# L9 q( R+ j
end: v2 y$ \! Y; [3 R0 q
5 R- Q2 H1 T% Y. P$ ^- t
to go
: b3 _9 C9 f- [$ r$ A ask turtles [set heading 90 * random 4 fd 1]1 g$ L8 \8 t$ K
ask patches with [ any? turtles-here]% R+ w8 Y8 {6 d2 s( l
[ if pcolor = green and random 100 < chance-of-congregating [tt ]]
/ e6 I" T$ C5 X" |- p ask turtles [ if energy = 0 [die ]]
7 i1 i4 r# m7 p& j7 _ end) H3 ]9 g+ Z- v+ Q! Y4 x) c
7 l* ` \+ y. o1 K' w8 U
to tt
1 ~0 K5 L! w" Gask patches [set pcolor gray ]
' }7 R/ ?3 Y7 v1 L- Pask turtles [set energy energy - 1]
' q9 z! `" F' ]end0 f" M, W6 ^3 C
6 m- ~( P F. [
|