请问:3 a; T! c2 U, n3 q! I2 {9 W
随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?( g6 s2 ]7 x/ J
9 F$ W5 t+ d' P: B( B8 l
& ~( q/ q5 w" H8 Qturtles-own [ energy ]7 l t# H7 r/ t! R2 S& X
to setup9 C3 z7 V6 y/ U# X, J0 w2 p1 o
clear-all. ~7 r. @: a4 y3 E
set-default-shape turtles "square"" O8 F+ Z q1 e( v# n! T+ X @
crt nutrition, f* D4 i. B3 i. m$ o
ask turtles[
* i" f/ Z* O S. K0 b& g# a set color white6 u% _* T8 E6 o( s% N! F+ I
setxy random-pxcor random-pycor]
( S- \. N1 x2 N# L 5 n# l( K$ K" r& z6 d$ J- W9 a
ask n-of microbes-initialization patches8 j# R" ~! J8 L- h" C
[ set pcolor green]
7 T2 B; X, p {* c ask turtles [set energy 1]
/ r% R2 S" e2 send% d/ y* \6 n B0 D+ m4 Q0 q# h+ M
" E% ]6 c/ x1 _5 s' e* R# R9 }to go3 W, Y( P2 H3 ~2 a, p8 F
ask turtles [set heading 90 * random 4 fd 1]
( B, `' l! t9 T' p I ask patches with [ any? turtles-here]
a4 x* W0 J6 d: @& D2 V% w8 y( W [ if pcolor = green and random 100 < chance-of-congregating [tt ]]
% Q7 R* s; ^1 T U9 u n& Y4 k ask turtles [ if energy = 0 [die ]]: {, O, V P6 W+ {. l" e, \
end
0 Y& Z% f. Z. ~7 D. Y. v& v `/ y q1 N" `
to tt
5 ~1 Z6 m' X: J! Z/ R9 ^6 fask patches [set pcolor gray ]; Z* h0 K+ v+ l H
ask turtles [set energy energy - 1]
. D! d4 v2 [) h4 p8 i! Nend$ T2 S1 N" N) w$ P- C4 b7 |) P6 p
1 Q0 I3 y6 a5 t# P7 g
|