请问:; \, _: }; R1 e% A
随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?) y' X" e& ~9 z3 R& i W+ M
9 `/ M- G4 i& I( H
6 p+ ?7 l7 e6 j$ W8 xturtles-own [ energy ]/ Y. B4 P* L( H' ~- H: ^& ]
to setup; H8 ]2 T. a! V
clear-all
- d4 _2 u6 u$ d' ] tset-default-shape turtles "square"
2 ^1 M" J" U! acrt nutrition: _ c J5 H7 L8 H' u
ask turtles[, w8 N: Q9 v2 h5 g, P
set color white
+ @. p, N9 q d setxy random-pxcor random-pycor]9 O! \/ S% m& v: x- F% d
% H6 y4 ?* x# G% ? `2 v/ E
ask n-of microbes-initialization patches
$ A% Q( R% O# t% ~( Q. I [ set pcolor green]. e5 K$ A& b0 j& ~- } ^& { f* w
ask turtles [set energy 1]
3 _8 t. M7 u) ^! L' V# l: h, ^end
# V! u. B/ b( N
, y6 b: }, K2 p8 q+ G; gto go6 w% W7 E7 i1 F2 |3 J% p, K
ask turtles [set heading 90 * random 4 fd 1]5 w7 C6 s3 o" }! b
ask patches with [ any? turtles-here]! d7 s/ P8 O( a; \
[ if pcolor = green and random 100 < chance-of-congregating [tt ]]
2 f6 e3 @' k8 Q" Y0 n ask turtles [ if energy = 0 [die ]]
% P& O- d% |0 [5 S) {% a end) H$ L8 v- X* y' Z! {( z- G) B4 s
8 F8 `: Q9 s6 T% Z* ~0 @2 m
to tt9 Y4 R7 ^0 l- {8 T
ask patches [set pcolor gray ]
4 j) ~+ _2 K0 K5 F; q; Rask turtles [set energy energy - 1]: S5 o" B9 I; p3 p% z
end2 ] y O; d; p+ w
8 o' @0 G# y. w9 o |