请问:
9 V1 { S& n9 e P) G8 S. n随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?0 [% m6 a. z- j& M! q
/ t% Q& m" Z8 v- `/ U$ M2 c
' m u8 V4 J* g9 H/ [& q
turtles-own [ energy ]* K u5 G9 A1 @* l
to setup4 d# o4 n# M1 L' L
clear-all
: W3 U- B; c6 t8 l& `set-default-shape turtles "square"
/ o3 E" K* P5 D( ocrt nutrition# t* d* k& O# F
ask turtles[
( C% `6 K2 G% I+ ]0 e! | set color white% L' C1 g/ ]+ P
setxy random-pxcor random-pycor]4 l2 O. j {& B6 H
1 b" S) U& [+ [
ask n-of microbes-initialization patches
! ?2 R& | p! K- `/ R [ set pcolor green]" N; `2 j h# q9 j: m* Q
ask turtles [set energy 1]9 [, o, y7 c1 b# t; i$ o
end
# ~+ d0 g' W8 E; D; |
) C4 B: }' b6 Wto go/ f4 O+ O1 A" s; u) a
ask turtles [set heading 90 * random 4 fd 1]3 s q5 Z4 {% A4 C
ask patches with [ any? turtles-here]/ O# [4 G0 |# l3 [. c
[ if pcolor = green and random 100 < chance-of-congregating [tt ]]
4 Y" D( u9 K; G9 a ask turtles [ if energy = 0 [die ]]
- s! K2 D% F% p end" |" z3 f7 J4 _' K9 g
1 T8 ?5 R" b' r% y
to tt
9 q) x' r; U% X, qask patches [set pcolor gray ]
* q1 E3 B+ u; M4 mask turtles [set energy energy - 1]
+ f1 d- i" I! n& L0 bend
9 q) z# h% x o+ M5 X- v0 K0 F( U, ~: d# a! T
|