【问题标题】:How I can count turtles with a certain variable in a patch with another variable?如何在带有另一个变量的补丁中计算具有某个变量的海龟?
【发布时间】:2019-02-15 14:26:22
【问题描述】:

我的显示器出现问题。 我想用另一个变量来计算具有某个变量的海龟总数,但一直没能做到,我得到的只是错误。 这是我所拥有的:

 patches-own [inovations?]
 turtles-own [income]

   count turtles with [income > 800] on patches with [inovations? = TRUE]

谢谢

【问题讨论】:

  • 你可以把[inovations? = TRUE]换成[inovations?],额外的= TRUE没有任何意义

标签: netlogo


【解决方案1】:

乌龟总是可以访问它所在补丁的变量。所以你可以这样做:

count turtles with [income > 800 and inovations? = TRUE]

这与您可以执行 ask turtles [ set pcolor red ] 和 count turtles with [ pxcor = max-pxcor ] 之类的操作的原因相同,即使 pcolor 和 pxcor 是补丁变量。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-10
    • 2015-11-27
    • 1970-01-01
    相关资源
    最近更新 更多