请问:
( Z/ F7 T% Z5 b5 o. n1 V随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?5 q- U z) w! p. A v+ `9 M* @9 E
4 l' _ h, ]6 G1 S9 F2 I: M : i& S+ l) D. r% B: Z% b
turtles-own [ energy ]8 U7 n- B. M3 Z% W+ U, F8 V
to setup
. V& V$ Z! U \ l! |! [/ kclear-all6 R% F' ]& C, \6 y! E# N
set-default-shape turtles "square" w4 I9 V; p6 j' b% D: Z8 S
crt nutrition
0 T7 k- L. o5 |/ S5 j4 U( G0 Cask turtles[" S8 `, f1 q# E' g! ^" T
set color white1 u2 I+ H8 B4 C6 G0 ^: D k# I0 i
setxy random-pxcor random-pycor]$ t; S2 Z [: |0 V0 D
; n" w! Y/ v: J9 \- a
ask n-of microbes-initialization patches
$ p, B% ~; H8 t0 `" D* T, f [ set pcolor green]
L2 J1 y! ], Z6 R+ k' s7 X ask turtles [set energy 1]( A$ }6 z& t U! ^+ S& c
end' V) L2 Y" h3 U2 R4 Y: V* B1 A
; ^: N) ~# w3 M- K3 ^- ^- J$ T
to go
" k+ J% G5 g/ \0 H$ V- B ask turtles [set heading 90 * random 4 fd 1]
3 B! |6 ]' N/ R ask patches with [ any? turtles-here]& Y; y2 O: d9 f& w0 t9 _0 ^
[ if pcolor = green and random 100 < chance-of-congregating [tt ]]$ k5 i- D; K3 [8 P& W: v* \
ask turtles [ if energy = 0 [die ]]
" e+ ?3 N3 Y* R# z D! f end6 Q3 k/ C! J6 I$ C8 ?4 V
% t( ?! [9 N- @, J& ?$ E/ C9 s
to tt7 R/ [; D1 H5 Y# x# e( [. N7 H$ P
ask patches [set pcolor gray ]
5 p+ C, Y0 a& d: r! s4 r4 N! a% mask turtles [set energy energy - 1]9 b. K4 t/ o; J+ X8 g2 \+ e, I
end: o) i* i/ D8 T4 e4 p/ C& Q
" {) l8 s! ?- L. s. C( `& K |