请问:: {; j5 D4 F( n- G! w1 ^9 R% @
随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?: V+ V! r4 u6 K0 E0 ]4 \) S( R
5 K: G" J2 t# W3 W - I% b D; Z2 t" W9 L, o
turtles-own [ energy ]
+ i# z# A% h! B Mto setup- Z5 N2 F+ K8 U) ^
clear-all
# k- _1 |: d/ V. R) t! `# W' u @set-default-shape turtles "square"+ E, I* x# R6 a! z7 v' o8 m3 w! ?( Z
crt nutrition
- g& U2 X# }8 q9 @$ ~ask turtles[/ P8 x) d& v D3 \
set color white1 C7 Z& e$ C* _. O' M$ V2 j
setxy random-pxcor random-pycor]( l9 {! M+ @( P4 v+ |3 I5 l
& N: r5 }/ Q2 zask n-of microbes-initialization patches
' A8 j, e# S* i [ set pcolor green]
: U4 p$ W- X/ j! l. ~$ k ask turtles [set energy 1]
9 t# q+ G, _$ {% k8 v6 }. P9 W, fend) i+ p& Z& m* Z9 |6 k) B2 v5 X
$ v# ]/ T( h( D# t& \9 e5 b2 F
to go5 I! K' d: [* ]" I
ask turtles [set heading 90 * random 4 fd 1]
+ x# o% t8 d s7 J9 d8 h* Y ask patches with [ any? turtles-here]; ] `8 g( d( w4 w9 K5 {
[ if pcolor = green and random 100 < chance-of-congregating [tt ]]) K1 [7 E% j( ^
ask turtles [ if energy = 0 [die ]]! _% I0 a! x" z/ b7 q2 T. y8 ]
end! k% i7 {& x I
8 i* A1 h/ _: I; l; q) rto tt0 ^$ z+ z4 J; Z& h( q
ask patches [set pcolor gray ]4 D k" d/ ]6 C
ask turtles [set energy energy - 1]( @0 J2 Q+ ]8 M. \+ g
end
, Y( h1 d1 |0 h& g, b5 ]7 q
) i3 Y4 p0 e5 K |