lincw 发表于 2008-4-8 10:49:43

turtle粘合patch的运动问题

请问:
随机产生的turtle 已经在patch的坐标上上下左右一格格运动,当turtle碰到一个随即分布的patch以一定概率粘合,patch变色,其他turtle经过也还是以一定概率粘合的,粘合后turtle的能量就会转变到patch上,并且以一定速率消耗它,怎么编写这个过程?下面是我编写的,运行时就出错了。怎么改正呢?


turtles-own [ energy ]
to setup
clear-all
set-default-shape turtles "square"
crt nutrition
ask turtles[
    set color white
    setxy random-pxcor random-pycor]

ask n-of microbes-initialization patches
    [ set pcolor green]
ask turtles
end

to go
    ask turtles
   ask patcheswith [ any? turtles-here]
    ]
   ask turtles [ if energy = 0]
end

to tt
ask patches
askturtles
end

lincw 发表于 2008-4-9 10:47:16

谢谢楼上两位,后来自己用两种turtle来表示暂时把问题解决了,以后再出现难题再向你们请教啊:)
页: [1]
查看完整版本: turtle粘合patch的运动问题