netlogo 运行时错误“turtles on”

发布于 2024-09-16 04:49:01 字数 132 浏览 13 评论 0原文

运行以下代码时

是否有? (海龟补丁提前q) [ 一些命令 ]

其中 q 是数字变量,

存在运行时错误:turtles-on 期望输入是代理或代理集,但什么也没得到。

可能出了什么问题。

while running the following code

if any? (turtles-on patch-ahead q)
[
some commands
]

where q is a number variable

there is a run time error saying: turtles-on expected the input to be agent or agent set but got nothing.

what can be wrong.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

删除→记忆 2024-09-23 04:49:02

可能没有patch-ahead q,因为海龟位于世界的边缘,面朝外面,而你的意志不会环绕。乌龟已经到了世界的尽头,面临着深渊。

尝试设置世界,使其环绕 x 轴和 y 轴。

It could be that there is no patch-ahead q because the turtle is at the edge of world, facing towards the outside, and your would does not wrap around. The turtle has reached the end of the world and is facing the abyss.

Try setting the world so that it wraps around on both the x and y axis.

御弟哥哥 2024-09-23 04:49:02
 let p patch-ahead q
 if p != nobody and any? turtles-on p
   [ some commands ]

有效,就像

 if can-move? q and any? turtles-on patch-ahead q
   [ some commands ]
 let p patch-ahead q
 if p != nobody and any? turtles-on p
   [ some commands ]

works, as does

 if can-move? q and any? turtles-on patch-ahead q
   [ some commands ]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文