gpt4 book ai didi

netlogo - 在 xcor 和 ycor 中具有均匀间距的海龟设置

转载 作者:行者123 更新时间:2023-12-04 19:07:12 25 4
gpt4 key购买 nike

我想在 NetLogo 中设置海龟,它们每 1 个补丁从 min-xcor 到 max-xcor 均匀分布。目前,很清楚海龟可以用 random-xcor 和 random-ycor 创建。请帮忙。

最佳答案

尝试使用 sprout . sprout告诉补丁直接在它上面创建一个海龟。因此,例如:

ask patches [ sprout 1 ]

将在每个补丁上创建一只海龟。您可以使用 with如果您只想在世界的一部分执行此操作,请限制补丁:

ask patches with [ -6 < pxcor and pxcor < 10 ] [ sprout 1 ]

您还可以像使用 create-turtles 一样包含海龟的初始化代码。和 hatch :

ask patches [ sprout 1 [ set color red ] ]

关于netlogo - 在 xcor 和 ycor 中具有均匀间距的海龟设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21525893/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com