【问题标题】:NETLOGO: Count patches outside of certain radiusNETLOGO:计算特定半径之外的补丁
【发布时间】:2018-04-17 13:41:50
【问题描述】:

我想从补丁半径末端开始向外计算特定颜色的补丁。有 in-radius 命令,但它考虑了补丁中心与其半径之间的空间,但我希望排除这个空间并开始计算半径结束的位置。任何帮助表示赞赏。

哈维尔

【问题讨论】:

  • nitpick: in-radius 不是命令;是记者

标签: netlogo


【解决方案1】:

如果一个记者使用member? 只返回一个补丁集,该补丁集只包含不是in-radius 的补丁?

to setup
  ca
  ask n-of 10 patches [ set pcolor white ]
  crt 1 [ 
    setxy random-pxcor random-pycor 
    set color red
    set size 2
  ]
  reset-ticks
end

to go
  ask turtles [
    ask patches in-radius 5 with [ pcolor = black ] [ set pcolor black + 2 ]
    print count ( patches-outside-radius 8 ) with [ pcolor = white ]
  ]
end

to-report patches-outside-radius [ radius ]
  let inrad patches in-radius radius
  report patches with [ not member? self inrad ]
end

【讨论】:

    猜你喜欢
    • 2014-08-29
    • 2020-02-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多