请问:
1 l9 Q/ e! j ^, H随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?' q5 t; F. Q+ X( v% G6 s, C
# w L n% v" S
2 w* H/ G0 `- n" tturtles-own [ energy ]8 N$ S" r+ m: a# a
to setup4 [9 M' z G/ V: V+ F
clear-all- Z s3 _4 D& x
set-default-shape turtles "square"
; A% Y! d' J$ g/ _( n1 vcrt nutrition
, C; @' f9 m' C/ V2 }. G, n4 z& x% Hask turtles[
+ v: _4 R f# H0 [4 ]' P/ K set color white0 W1 U# i! b5 c: [
setxy random-pxcor random-pycor]
2 \. K; j- `: |4 r3 O8 V$ f8 H
+ Z5 _" L( @8 q+ n# x/ t% h& H7 Aask n-of microbes-initialization patches. ?/ \' X4 ]9 k( T: W
[ set pcolor green]
& T# v5 Y/ x9 C! ^4 o0 ]6 b6 @ ask turtles [set energy 1]8 }. k( X! r% ~$ E2 f J3 s
end8 W( N& a0 u. M( s I7 I3 c
) r! t5 @. X+ e% |/ A) z
to go
1 o8 v4 D7 H$ n8 O, s+ ` d ask turtles [set heading 90 * random 4 fd 1]- E% V- C7 {5 o: r9 n
ask patches with [ any? turtles-here]
2 r+ a5 Q& B3 E% p( M# P [ if pcolor = green and random 100 < chance-of-congregating [tt ]]% q. a3 V- N) a6 L m
ask turtles [ if energy = 0 [die ]]4 O6 m, S& i0 b/ l) Q# L0 c" R
end
" I; L8 x6 K9 g6 m& t
) ~, m1 e: v \" ]/ V% |; pto tt4 [/ I, R6 M- v9 |, Z8 ^
ask patches [set pcolor gray ]
& S. J; f9 N4 Wask turtles [set energy energy - 1]# J8 o2 S0 t T" R
end& x$ j. F1 N1 ]9 Z8 I2 E7 O) m. s+ M
& D2 U" a, T, e2 P2 q! _
|