请问:
( }# t4 V1 V3 _( U5 s7 u6 V随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?$ y% H) c% H* L9 {. v3 s
3 d' Q- U3 J- L9 Y6 B4 D
2 h3 r$ F* j$ H" C4 R0 qturtles-own [ energy ]+ h& ?( n6 V( h
to setup7 H" Z! E: j, o8 \+ ]
clear-all& [( Q4 w7 M$ t2 c" I7 ^, ?. c6 k/ M
set-default-shape turtles "square"5 Z( b9 t- n1 f5 J ]' s7 f r) j
crt nutrition
! z- C; A' B7 ^9 task turtles[9 i) u; a* Z- ?. M' c$ R
set color white$ B& Q% y; g5 K3 r; V* m( C" |+ w
setxy random-pxcor random-pycor]" Z; E$ N6 y2 n. Z: k( I7 e1 _
0 |" H, Q9 o. [; X
ask n-of microbes-initialization patches( g/ V6 f/ B( v) N; _6 b
[ set pcolor green]
; ~ Z3 O, _! v0 e; X9 f5 x ask turtles [set energy 1]* \ u2 ~+ c' k* m
end
. Z3 M. {, c3 h/ r& Q, [4 J5 ~7 X& w* b
to go, p) c9 c8 P) e4 z
ask turtles [set heading 90 * random 4 fd 1]
3 W8 M* f3 v H5 Y% l ask patches with [ any? turtles-here]
/ G: A! h( i, G [ if pcolor = green and random 100 < chance-of-congregating [tt ]]; | J. s s, [/ U9 i7 H
ask turtles [ if energy = 0 [die ]]" C m0 R: R3 G5 ^- F' R* E
end
: _ l: `! j; J! d' m F1 @8 k# F o6 N% f5 y0 ]6 t
to tt4 u+ F5 u$ l9 E0 _
ask patches [set pcolor gray ]
% ^8 }% M6 V. c- qask turtles [set energy energy - 1]+ _& J" a) N& {) Z1 s4 q
end
; B* B! x2 o( N
7 z V! l3 g0 l) _+ q, t+ S- p |