请问:, a# D v" i3 m& A% F, z
随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?, Q9 M1 s- ^: J; g9 J( p1 K: y
/ u2 Q4 ?" R! y# B: P6 ~* R
' Z, `+ g0 @4 g0 J
turtles-own [ energy ]
+ d m0 {( m9 tto setup
; S+ V6 A" P* r, Z+ s& w' Dclear-all
1 Z+ o6 n$ h5 Qset-default-shape turtles "square"7 `& Y: S. e1 O8 U4 B9 A! x; [# a
crt nutrition
! K8 H `$ y- h1 Q+ I3 a3 Jask turtles[& _# n2 O6 x4 d' Q. o! i
set color white
$ b/ ~7 @1 i9 V# U2 ?; A8 X0 j setxy random-pxcor random-pycor], [0 M- i: c V0 H- `$ v" X: u
q7 _! R" n' vask n-of microbes-initialization patches
j. P- O; V8 {5 s. M4 _$ y' i [ set pcolor green]. s: s8 d- f$ |, V. D+ C
ask turtles [set energy 1]8 \+ U! ~1 K6 R
end
4 c; j Y! w; V- }7 p2 g4 N! _; x- ~- Y: e& x1 B5 C$ ]
to go- I; |6 Z9 y0 ?7 m
ask turtles [set heading 90 * random 4 fd 1] P D# c3 Y% `" b7 d( l1 s. A7 n4 r- J
ask patches with [ any? turtles-here]
) k! c I+ ^! z/ K5 M [ if pcolor = green and random 100 < chance-of-congregating [tt ]]& d' y$ \: K: O8 l
ask turtles [ if energy = 0 [die ]]; V; s9 w7 |% h, v
end- q: P# h: M$ q0 g- @! d5 D
; { F' I- _5 eto tt/ S% c: I) u$ G3 m
ask patches [set pcolor gray ]
; f3 R2 S3 Z/ j: G0 [0 A: Uask turtles [set energy energy - 1]" ]! P; V# X3 N. B3 Y0 G
end) \7 A0 r: E1 e$ O6 H
- m4 r9 S( e& w% ?. O7 ?9 h! H/ z
|