请问:
9 s" p$ d% a4 N! F随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?; }( b& y0 r- @+ z& Q( n& g
+ w/ G7 p, V" {! e1 U1 ?
7 p& o3 ]9 K6 `# s) r6 g# Z
turtles-own [ energy ]% S& o, b: r3 p+ C! ~5 W1 P( A
to setup/ {3 ^% H9 H$ V- s
clear-all0 K/ {( _, L+ p
set-default-shape turtles "square"0 X. Q6 i( x' j9 ]! D F
crt nutrition
# c3 b8 I8 e* p. \) S; {' Eask turtles[( u& N9 j4 |) ^+ [( |8 U) V. m
set color white
5 h) I4 W! V$ Y" D. |6 J2 Y setxy random-pxcor random-pycor]5 m8 R5 u! i/ o$ ?1 R
; Z; a- H) K" o, c) ]$ o
ask n-of microbes-initialization patches; y- m0 V3 B0 w/ v4 T; B
[ set pcolor green]
1 `- F* g* V- ]2 W- _" v) J ask turtles [set energy 1]9 J4 L+ g( o; l' O' f4 L
end' K, S9 e; `4 c- f' P
. S, ~) y. e' D4 g& z5 r# `
to go
3 }5 X. i" s* J3 x ask turtles [set heading 90 * random 4 fd 1]( B4 I+ {2 k9 a/ l' v
ask patches with [ any? turtles-here]
7 [3 z' [' r, C2 z9 x! G, T [ if pcolor = green and random 100 < chance-of-congregating [tt ]]5 c2 ^1 J) F' ]) M( i& ~6 n! m
ask turtles [ if energy = 0 [die ]]
5 R* F% t( ^; r6 k" c9 Z: W* A5 } end
& r0 z( _3 f2 _5 D- D- i8 X
! w6 W& a( z/ ~( k% C. o9 Rto tt/ x! I: F% o7 M2 y0 q; q
ask patches [set pcolor gray ]
0 r; K' @# f6 G, P) O! L% wask turtles [set energy energy - 1]' e5 g& c7 g3 v L8 K1 G b
end; k/ H( U8 r) M/ @( s' O: E
4 Q8 A2 M9 m; }# U# P/ n
|