NETLOGO:计算特定半径以外的补丁

时间:2018-04-17 04:39:27

标签: netlogo

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

哈维尔

1 个答案:

答案 0 :(得分:3)

使用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