NetLogo 以固定距离创建海龟 [英] NetLogo Create turtle at regular distance from each other

查看:114
本文介绍了NetLogo 以固定距离创建海龟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在彼此固定的距离处创建乌龟(并且能够改变这个距离).我不知道我该怎么做...有人可以帮我一把吗?

I would Like to create turtle at regular distance from each other (and be able to change this distance). I have no ideas how can I do that... someone can give me a hand?

推荐答案

如果您的意思是具有特定最小距离的随机排列,您可以通过滑块或其他参数更改距离,您可以执行以下操作:

If you mean a random arrangement with a certain minimum distance which you can change the distance via a slider or via another parameter you can do as follows:

首先创建一个滑块并将其命名为Min-Distacne",然后将最小值更改为 1,将最大值更改为 10(仅作为示例)并以 1 为增量.例如,在一个 50*50 的世界大小中,170 只海龟看起来像这样,最小距离为 3 个瓦片:

First create a slider and name it "Min-Distacne" and change the min value to 1 and max to 10 (just an example) and increment by 1 . For example in a 50*50 world size 170 turtles look like this with min distance of 3 patches:

  create-turtles 170 [

    Set shape "person"
    move-to one-of patches with [not any? other turtles in-radius Min-Distacne]
  ]

这篇关于NetLogo 以固定距离创建海龟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆