请问:
) n8 _( _ F& j- @% F随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?
3 N c0 A7 Y' P6 B, l8 m- j( S' a
5 h9 z/ P9 y) }turtles-own [ energy ]2 B1 V: O: R4 m, ?$ r
to setup7 J/ e. p8 Y4 b3 R* _
clear-all
% Y {9 Z+ I4 G6 ~+ a2 H2 Q% cset-default-shape turtles "square"
0 t+ L$ [- S& g# ucrt nutrition: d4 g. w/ j( j
ask turtles[
: u2 C" E' @2 {* w5 _9 _ set color white
7 O. \) X& a- B& l" x0 z setxy random-pxcor random-pycor]
; x1 U0 q% I( Z& M" X. i" Q; B
# m* G: K7 H4 cask n-of microbes-initialization patches
0 A# k. O, l: L [ set pcolor green]% o% @# n6 J7 G
ask turtles [set energy 1], H; Z7 Q! g6 ?, l
end4 X4 o$ F! ]% ]9 H q
9 D2 l/ S" R" \6 Z' }( D+ ?- S" }, v$ a
to go. l" l; U- y, y2 w u `9 @
ask turtles [set heading 90 * random 4 fd 1]
3 a. w% F. ?2 X8 b* j( x ask patches with [ any? turtles-here]# ?+ I( d' j. D
[ if pcolor = green and random 100 < chance-of-congregating [tt ]]/ }8 L. n, N" t1 K! A9 W+ K6 Q
ask turtles [ if energy = 0 [die ]]+ I" D$ T p8 f( P$ J2 V- L' a
end3 e3 Z5 a7 W) d X1 y7 ~% Q
# v' m2 d. R' y. cto tt
* j# r u. j& v y9 e, Pask patches [set pcolor gray ]
: F/ G; `/ q9 r2 G3 \ask turtles [set energy energy - 1]
# G" r; T9 E3 n' Uend2 e9 @. }0 O; x
3 H' H5 w( H$ ?$ T |