请问:
1 B6 L& M. K( j2 {3 c随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?0 F4 H/ P: R4 [1 G# y2 Y) h
, I" P8 B3 P) w. T6 {5 q : r, h: Q, g5 ~4 q6 `
turtles-own [ energy ]
( h' U! W8 d7 c/ uto setup
1 J5 w1 Z$ K) Y' ]1 `clear-all3 z/ g# P2 c# e
set-default-shape turtles "square" V, q8 O) `. h+ w
crt nutrition2 W' O$ u- [9 B0 X% Q
ask turtles[. K) d! U/ H! N+ U3 E3 d7 C/ l
set color white
. `6 v/ P9 b( H; \% |7 o setxy random-pxcor random-pycor]4 Y# r) z$ [" }( r4 o
5 ?* g6 c3 u5 T3 R7 b
ask n-of microbes-initialization patches, r+ z% H: @: ~1 f0 q4 _" w: W
[ set pcolor green]( r3 X- E+ G L* f+ L0 U
ask turtles [set energy 1]
3 @+ c$ I- I( ]! h0 l. u! H- Zend0 o- T( d6 }* Z. J& c; i
8 |" D, I# ?7 t" D$ C5 wto go8 d& C( p0 Z% e: b' m9 ]! M' m
ask turtles [set heading 90 * random 4 fd 1]
+ V, R- e$ d7 v8 Z: J ask patches with [ any? turtles-here]; C! ` _$ d: s; W, S7 A
[ if pcolor = green and random 100 < chance-of-congregating [tt ]]
4 c3 V+ ]* x7 `* C5 ~; ?( X* [: R& V, ? ask turtles [ if energy = 0 [die ]]3 j6 H: S+ H8 a0 s5 |+ T/ V
end
, i" L. k( I: K9 g8 v. W
% c, E1 C7 e4 H- M* z4 n7 A, dto tt
, }$ A$ y C N* k6 y" v% i& }ask patches [set pcolor gray ]
9 L7 C! M# B% I; V: gask turtles [set energy energy - 1]6 D) W( W6 | D6 J4 O
end
* _0 k8 j$ m' S; `. l# z
7 F* ^$ b8 A( e3 ^6 `% E |