请问:
5 T6 ], r# v+ x/ b e6 {随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?( F2 M' n, f# n# o+ }; J
: r# h* e" m& N/ \ - E/ U* S# \1 x3 X0 H% X
turtles-own [ energy ]
9 B9 A' A ~) g1 J d* ^to setup7 V, W* d. |$ {
clear-all& a3 N3 o2 g- i' D% V, M; ]" M
set-default-shape turtles "square", E3 ?9 v* R1 \. y
crt nutrition, x4 I9 A) E+ c% W5 V
ask turtles[
+ n, n9 V0 k$ B: O, V set color white" A+ J- G) z M3 J
setxy random-pxcor random-pycor]* T+ R) P( H2 p" G$ U! s p
$ T& ?/ z j# ~% Yask n-of microbes-initialization patches
* j. q( E" }, G# h. _ [ set pcolor green]2 k! W" x. e6 S$ O* t, f, r
ask turtles [set energy 1]
{8 H J& n9 l9 Q" q# Dend8 k8 `5 q7 a; T: k3 o {- y
; n% J+ w1 _ r: ^/ K( j% G& cto go. ]6 ?" r4 V' B# q
ask turtles [set heading 90 * random 4 fd 1]
+ u4 Q1 `4 q+ I: k ask patches with [ any? turtles-here]3 `. H" H2 o7 [, L& ~
[ if pcolor = green and random 100 < chance-of-congregating [tt ]]2 v1 w% H6 R/ w2 e! r9 S* H8 D
ask turtles [ if energy = 0 [die ]]' @/ R1 Y- A) }% a
end
0 M+ S" e p& s
! K) o, z0 Q# Y+ t/ O' n ato tt
5 w. I0 ?. y. \) dask patches [set pcolor gray ]
7 t" h6 B: A' N$ ?& K8 }, Rask turtles [set energy energy - 1]
+ j9 \! Y( ^! @1 P% W6 H2 lend0 {5 M# B- G6 F! X
0 x) }( a" L: s5 |7 Y& ^* } |