请问:
6 `4 e' Y% Q$ U1 b$ W! q" N! n& z随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?' c9 |. ^ c1 e9 l1 @7 S
6 ^0 U; C$ f' A
) ]/ t6 e* u8 Y* F
turtles-own [ energy ]
8 P$ h3 F; q8 w9 R8 u8 ?. g# s0 t! ito setup1 A' Q {" a1 |2 [* D! _
clear-all: y6 L+ p" g! T f0 R F$ N `
set-default-shape turtles "square". T1 k3 N% i7 w# D0 p) z, Q
crt nutrition: j: k: z3 G0 `6 ^6 t# N$ f: E
ask turtles[
7 Y8 m% u1 y9 A8 ^1 n. U set color white1 j' Y, q1 e g0 l; Q
setxy random-pxcor random-pycor]9 H* s9 W7 q3 o- I+ p/ M
$ ] ?% r6 {. v# [. yask n-of microbes-initialization patches# n1 `7 R1 m. v
[ set pcolor green]
! n! h. |+ F7 G5 p* A* a ask turtles [set energy 1]
# `: u; [4 B) l/ L8 q* c3 gend
" T3 Q; d' |% ~2 }* L0 y4 W& V6 V7 r" h/ p
to go7 I* q+ O' Z1 [0 x% P9 {9 v
ask turtles [set heading 90 * random 4 fd 1]6 h. q) ]% ], r% C1 X
ask patches with [ any? turtles-here]
% F0 C" c+ b+ D3 ] [ if pcolor = green and random 100 < chance-of-congregating [tt ]]
: {% D& u$ C* c- c ask turtles [ if energy = 0 [die ]]
5 q0 v' u+ k6 M3 x end
9 o9 G$ A: \1 f. }! G+ H; Q6 z* M/ S3 w4 u- `2 [5 |
to tt3 o" v% _# _3 d4 O- r, B) S) v9 y
ask patches [set pcolor gray ]
+ E$ Y9 t& J' m) T! \ask turtles [set energy energy - 1]0 s- Y- k4 K3 o, _5 J- g
end
. x" v. y/ U' _2 w
6 M# V0 W6 k: P6 m$ {9 L; W* _; V+ ~ |