请问:
- B9 a, S; Y) t, a6 _随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?
2 F' w% o" m2 M1 l5 c
/ ]. D8 ^# l6 _# l
) O! U, {4 b3 X: lturtles-own [ energy ]: V+ j z0 \8 X
to setup" o& C1 Q% e$ t7 O9 {8 q
clear-all
' G: w3 h: Q5 r/ `0 `( Gset-default-shape turtles "square"
5 J& B7 Q# ?' u3 tcrt nutrition4 V( `3 C. V$ N/ Z# L. Q+ x) i4 L
ask turtles[
9 c m2 C5 H7 B: }( _+ z& p" P set color white0 O, v2 k+ m! r$ `3 D4 }$ J2 m- d
setxy random-pxcor random-pycor]
- e9 Q; R- }& }1 Q9 d2 u, R& z- L 6 j; ]4 Y6 d. U) n' l: h
ask n-of microbes-initialization patches
5 F. k* M q# d) W) { [ set pcolor green]
. d% v5 \1 v- C# c3 u ask turtles [set energy 1]
5 V6 ^; W7 n- U( Vend' D) p6 R7 @9 U% f$ o9 Y
! |. ~ ~/ E- T, x9 T$ O
to go
" f, q4 n0 R7 X ask turtles [set heading 90 * random 4 fd 1]6 D3 v9 O' c' Y# L$ o7 `: B
ask patches with [ any? turtles-here]
b4 H1 x; d( u- n' `* v [ if pcolor = green and random 100 < chance-of-congregating [tt ]]
0 l. D8 v G- Z! v* B2 Y ask turtles [ if energy = 0 [die ]], z5 J! f, L& s) t" T; a5 h ]) i
end/ a! q0 H- D, Y x! [2 H w5 l! i
) T/ {6 _; E& t1 P. |) I9 F
to tt! c& j0 b) Q, R f* E6 x+ L
ask patches [set pcolor gray ]; R% a3 U& N: S2 j) z
ask turtles [set energy energy - 1]5 a: r1 i; y2 E4 V9 H
end( ?- G! `( Y w8 D2 N
, B1 d0 i" t, ^* y0 c" G& T6 N% u |