
[英]Netlogo: Setting pcolor patches with specific distance from each other
[英]NetLogo Create turtle at regular distance from each other
我想以彼此固定的距离创建海龟(并能够更改此距离)。 我不知道该怎么办...有人可以帮我吗?
如果您是指具有一定最小距离的随机排列,可以通过滑块或其他参数更改距离,则可以执行以下操作:
首先创建一个滑块并将其命名为“ Min-Distacne”,然后将min值更改为1,将max更改为10(仅作为示例),并增加1。 例如,在50 * 50的世界尺寸中,最小距离为3个斑块的170只海龟看起来像这样:
create-turtles 170 [
Set shape "person"
move-to one-of patches with [not any? other turtles in-radius Min-Distacne]
]
有了Marzy的回答,所有海龟最终都到达了补丁中心。 那可能实际上就是您想要的! 但是,如果您想让海龟最终落在任意点上,则可以尝试:
to setup
clear-all
create-turtles 170 [
while [any? other turtles in-radius 3] [
setxy random-xcor random-ycor
]
]
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.