请问:
) Y6 A7 Q* u9 A2 e随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?; h. ^1 d" f* S$ D0 v
2 M Z3 |, q! B% O: ^
: y0 Q+ M e/ h+ ~5 r9 z( ^- Wturtles-own [ energy ]* ]3 `* Y7 e0 y5 P0 m" G
to setup) L2 ^- H7 V/ c& U% e$ J6 k
clear-all; x. [. n4 l' V. X* }; h
set-default-shape turtles "square"! @. c6 Q2 Q! K3 p* P; }4 y U) s
crt nutrition
" [$ W K% V2 k5 C1 X3 {- yask turtles[
# x2 `) |3 d: ~1 D3 ^ set color white
. T) V% O! B' ~/ x1 {0 F# r setxy random-pxcor random-pycor]: _$ _. k0 q' X) G6 t& K/ N) n
: z9 p3 B0 d& N3 Bask n-of microbes-initialization patches
$ [; S" g4 h( f( S8 } [ set pcolor green]; k4 N& _# ?6 [
ask turtles [set energy 1]: G7 N; W9 J9 Y2 Z, o. T% }
end- ?! d* z) v/ I0 d2 P. G- d! ~
( ~' G2 h1 m0 c
to go
2 I- [4 C6 q4 r+ R ask turtles [set heading 90 * random 4 fd 1]
; W; [1 G! W, T2 X1 `- x' o ask patches with [ any? turtles-here]
N ^# E+ H; e0 ^" R) R [ if pcolor = green and random 100 < chance-of-congregating [tt ]]
% R$ w* p0 {9 W9 ~- n! T) G ask turtles [ if energy = 0 [die ]]. _* b" c3 V6 |# i
end6 D, L# p* j2 L7 D U
0 k+ J6 K/ H& [
to tt
! E+ y) x9 {& N) \8 Gask patches [set pcolor gray ]/ B' j; {( X$ O8 T' x& L
ask turtles [set energy energy - 1], n, w* }( y7 f6 ]* z% ^* O
end+ j, H3 q0 ^- P% g J
( {- ]( {- U2 w" o; i |