【问题标题】:NetLogo Initializing Turtles at Specific Co-OrdinatesNetLogo 在特定坐标处初始化海龟
【发布时间】:2015-11-17 16:24:03
【问题描述】:

在 NetLogo 模型中,我在空间中有一些“植物”乌龟。其中的数量是 5,并且永远是 5。

set-default-shape plants "plant"
create-plants 10
[
  set color green
  set size 2  
  setxy random-xcor random-ycor
  setxy random-xcor random-ycor
]

目前,这些植物中的每一种都在世界上随机生成。我希望能够设置这些植物的放置点。

类似于:

setxy plant-1 25 25
setxy plant-2 25 25

有什么办法可以做到吗?

【问题讨论】:

    标签: netlogo agent


    【解决方案1】:

    目前,setxy random-xcor random-ycor 行正在将植物的 x 坐标和 y 坐标设置为随机值。请注意,您的代码中似乎有该行两次。它的第一个实例被第二个覆盖。无论如何,您也可以使用setxy 将植物移动到特定坐标,例如setxy 25 25。但是,将setxy random-xcor random-ycor 替换为setxy 25 25 会将所有植物放置在该位置。我假设您想要多个特定位置的多个工厂。为此,您只需要求单个植物移动:

    ask plant 0 [ setxy 25 25 ]
    ask plant 1 [ setxy 10 40 ]
    

    等等。

    【讨论】: