请问:
1 v/ J3 Q7 o; ^/ S7 C随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?
+ e- y0 I. |# q; L# y4 K6 d5 R' V" W
: l* f$ C* R7 L" y - l; Y |! k4 f! J
turtles-own [ energy ]+ X9 ?7 ]. c; X: D" }: R# f
to setup
/ q# E( t$ X5 @' W8 g: B. V# Bclear-all5 T0 ]9 f3 q2 }: l \" d; d, @
set-default-shape turtles "square"1 V2 e: k3 h( b" B F9 a% ?$ t- s
crt nutrition/ c6 {& v! y% z: P& @
ask turtles[- L4 }, k K6 ?) N
set color white% g1 {- c& s# v& ?; F
setxy random-pxcor random-pycor]% m( r" t7 G- O6 Q
' s% i) |4 p2 S3 p
ask n-of microbes-initialization patches3 Y; j6 b% S" p1 _1 t3 @; X
[ set pcolor green]) U% p" F- q) C! P+ M" _
ask turtles [set energy 1]1 O1 @- z" l$ s0 K# Q* j- d
end+ V- L0 H+ K. E: N7 ^
/ e9 o* _* F) c$ x- w `/ sto go
# y+ K$ F. e' [( P' b: { ask turtles [set heading 90 * random 4 fd 1]
& z$ X! J# |1 Y U6 ~; b ask patches with [ any? turtles-here]: A: f6 J2 R6 D% y5 h
[ if pcolor = green and random 100 < chance-of-congregating [tt ]]) b/ O. W; k9 p) x7 e
ask turtles [ if energy = 0 [die ]], k- {5 }. Q, l; R. u
end' z2 ]2 Y4 C" V8 p
1 `. C4 ~- w8 U" _
to tt" k, [! A+ R# ] L# J1 {
ask patches [set pcolor gray ]
2 V% E6 a/ p ^ask turtles [set energy energy - 1]
- f" b/ p: |. Lend% q5 t9 r+ K. @/ N |9 L. j' _6 J
0 }: h. H- V$ h( g+ [0 X! o |