【问题标题】:How check if there is any turtle ahead of this turtle如何检查这只乌龟前面是否有乌龟
【发布时间】:2014-10-16 16:54:52
【问题描述】:

我是 netlogo 的新手,我希望有一个“排队”来支付杂货模拟。但我的问题是海龟自身重叠而不是排队。我想检查前面是否有乌龟,如果是,那么乌龟会停下来。

【问题讨论】:

  • 不错的尝试,但它一直是乌龟。
  • 哈哈非常有帮助的朋友

标签: simulation netlogo turtle-graphics


【解决方案1】:

documentation for the turtles-on primitive 有一个这样的例子:

ask turtles [
  if not any? turtles-on patch-ahead 1
    [ fd 1 ]
]

您可以改变patch-ahead 使用的距离,但如果您选择小于 1 的值,则只需要检查 other 龟:

if not any? other turtles-on patch-ahead 0.5

【讨论】:

  • 我一直在挖掘该文档,但我从没想过 turtles-on 是正确的。谢谢你
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-08-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-12-09
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多