请问:
; p7 n1 {6 z2 T! ~* L0 h6 u随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?4 W# ]5 b& Q: x4 {
6 V0 |" M3 k/ |5 U" E) v0 i' r
& U; T3 J) m/ G% |( s
turtles-own [ energy ]
' k" Y u5 Y' t, Jto setup7 e) D+ B! p3 _% O. T5 I9 I
clear-all7 H v. p! E: ` G2 o4 n
set-default-shape turtles "square"0 c$ p3 S7 V8 o
crt nutrition, R- e, l: Y7 H+ H
ask turtles[* D+ \7 t, D$ k
set color white# A( ` s; M! F1 z& M, ]
setxy random-pxcor random-pycor]
: e5 w3 \& d, @, M : O& S/ |5 [2 Z$ x6 c- y( R& o w
ask n-of microbes-initialization patches6 d8 ^( C' G7 K
[ set pcolor green]
% |; s3 _" y& N) O) Q ask turtles [set energy 1]' K/ N9 }( _7 Y4 L
end, t5 `* {- h) D5 n8 O+ q* a; E. w' p
$ u, f* {- s( H- Q2 a7 ?to go
. }+ v1 h4 f) ?/ { P) |0 |: a$ e ask turtles [set heading 90 * random 4 fd 1]5 q8 C2 Q/ D2 q
ask patches with [ any? turtles-here] S G3 {3 ^1 k, b
[ if pcolor = green and random 100 < chance-of-congregating [tt ]]
0 Q$ s. C4 t0 s ask turtles [ if energy = 0 [die ]]
& u: x& D5 J' G7 L7 _ end
- v/ ?2 E# V% k2 n! O
& z4 ~" q% {1 C0 {5 N5 N- Tto tt
! f- H' t8 }2 `7 m8 sask patches [set pcolor gray ]
9 Z5 B& s, o; F) ]) n2 e' A4 g1 Wask turtles [set energy energy - 1]6 i1 G9 o1 H+ x+ k5 G
end
8 U U. j: R% E. ], G' j8 o ~. E [( V3 q* T
|