当海龟在斑块中覆盖世界时,我希望海龟能够停留在最后一片上,这样我才能记录下它们的蜱虫数量。
如果可能的话,我希望在随机位置设置刻度线,但只能随意面向北,东,南或西。
到目前为止,这是我的代码:
globals [marked-patches angle nextangle]
to setup ca ask patches [ set pcolor black ] crt turtle_amount
[set color red
set size 1
setxy (random 20) (random 20)] reset-ticks
end
to go ask turtles [
fd 1
rt random trt_ang
lt random trt_ang
if pcolor = black [set pcolor yellow] ]
tick end
答案 0 :(得分:1)
在go中,特别是在turtle命令中,您可以添加:
to go
ask turtles [
fd 1
rt random trt_ang
lt random trt_ang
if pcolor = black [
set pcolor yellow
if count patches with [pcolor = black] = 0 [
stop
]
]
]
tick
end