在一个补丁周围移动海龟
Move turtles around a patch
我正在尝试从世界中的随机位置开始在补丁 0 0 周围移动乌龟。但是圈子不断增长。我在这里做错了什么?
代码:
to setup
clear-all
create-turtles 5
ask turtles [
setxy random-xcor random-ycor
]
ask patch 0 0 [ set pcolor green ]
reset-ticks
end
to go
move-turtles
tick
end
to move-turtles
ask turtles
[
face patch 0 0
right 90
fd 0.01
set pen-size 3
pen-down
]
end
其次,我想让一只乌龟在到达某个范围内时在我定义的任何补丁周围移动
您的方法是沿着您想要的圆的切线迈出一小步,但这会使您稍微超出圆圈。你反复这样做,所以它会随着时间的推移而累积。
有关更好的方法,请参阅 NetLogo 模型库中的海龟盘旋示例。
我正在尝试从世界中的随机位置开始在补丁 0 0 周围移动乌龟。但是圈子不断增长。我在这里做错了什么?
代码:
to setup
clear-all
create-turtles 5
ask turtles [
setxy random-xcor random-ycor
]
ask patch 0 0 [ set pcolor green ]
reset-ticks
end
to go
move-turtles
tick
end
to move-turtles
ask turtles
[
face patch 0 0
right 90
fd 0.01
set pen-size 3
pen-down
]
end
其次,我想让一只乌龟在到达某个范围内时在我定义的任何补丁周围移动
您的方法是沿着您想要的圆的切线迈出一小步,但这会使您稍微超出圆圈。你反复这样做,所以它会随着时间的推移而累积。
有关更好的方法,请参阅 NetLogo 模型库中的海龟盘旋示例。