请问:
& C1 C8 g6 S3 {, B% S2 @8 [随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?) U" {+ D9 T- n1 a; B
1 v1 U1 k2 o/ D
0 Z( u& }# x( U. _1 @turtles-own [ energy ] z; h: f' `7 i
to setup# R( x- Q' _$ ^& Q
clear-all
# W& J$ k# W9 g9 i9 E- H8 Bset-default-shape turtles "square"9 K0 M* X! Z' e& L9 R2 O2 S
crt nutrition. D9 K0 N0 d' ?+ ]& Z, {
ask turtles[
( C' p J" v; b' O/ X set color white! g9 @8 `% C) @' n' g' e0 _
setxy random-pxcor random-pycor]2 A3 L" o, H0 f( x" S
$ a9 S: i/ Q- `/ L- S
ask n-of microbes-initialization patches
! {/ s* _+ V% s& F& g' b" q [ set pcolor green]
^ a1 e7 a; L ask turtles [set energy 1]- y4 C! l. V% n+ A2 T. [* @
end
$ s/ ]- O$ N/ k! c3 b& y+ [
- z( F+ _* q2 B/ C$ }" }7 qto go
+ ^8 j4 p& z h, \ ask turtles [set heading 90 * random 4 fd 1]
* {" K7 S* z$ t @ i/ m ask patches with [ any? turtles-here]' [" ?- R% ^2 o3 E D5 r6 t
[ if pcolor = green and random 100 < chance-of-congregating [tt ]]" r% ^) g, ]8 x2 s" a- h
ask turtles [ if energy = 0 [die ]]8 ]* k+ v/ r* u
end
5 |+ K6 Z$ O8 D( p+ ]/ o, C, J0 Z9 I' b/ b
to tt. x+ O1 d+ ~- x
ask patches [set pcolor gray ]
e0 G) g) c; J& N! J9 V. m0 X7 o/ Q8 H7 M, fask turtles [set energy energy - 1]
4 @: K! B3 K g/ [6 J+ k4 q" Hend7 G6 w1 ^7 {: U* A$ t' z
7 V9 w9 [" s t. ^ |