NETLOGO:计算特定半径之外的补丁
NETLOGO: Count patches outside of certain radius
我想从色块半径末端开始向外计算特定颜色的色块。有 in-radius 命令,但它考虑了面片中心与其半径之间的 space,但我希望排除此 space 并开始计算半径结束的位置。感谢您的帮助。
哈维尔
使用 member?
到 return 仅由非 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
我想从色块半径末端开始向外计算特定颜色的色块。有 in-radius 命令,但它考虑了面片中心与其半径之间的 space,但我希望排除此 space 并开始计算半径结束的位置。感谢您的帮助。
哈维尔
使用 member?
到 return 仅由非 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