【问题标题】:Count turtles in netlogo在 netlogo 中数海龟
【发布时间】:2020-08-09 07:09:29
【问题描述】:

我想用下面的代码在 Netlogo 中创建一个按钮,但是计数的问题在观察者中显示为 0 而它应该是 10,知道为什么吗?

    breed [ planets planet ] 

planets-own [ distance-to-earth diameter heading ] 


to create_planets
 ca 
  ask n-of 10 patches [ sprout 1 ]
  show count planets
end

【问题讨论】:

  • 谁投票关闭这个并且投了反对票,如果你不懂语言,请不要试图关闭 NetLogo 问题。这是一个非常好的问题,OP 已经声明 count planets 返回 0 而不是预期的 10,并且提供的代码是正确的代码。

标签: netlogo


【解决方案1】:

您将补丁告诉sprout,但不是说您希望行星成为发芽的海龟品种。这将创建通用海龟。请改用sprout-planets

【讨论】:

    猜你喜欢
    • 2016-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多