我希望我的外环补丁的pcolor为绿色 我写了以下命令
To setup
ask patch 0 0 [ set pcolor red
ask neighbors
[ set pcolor blue]
ask patches with [pxcor > 1 and pxcor < -1 and pycor > 1 and pycor < -1]
[set pcolor green ]
]
end
我得到了所需颜色的中心和邻居,但是补丁圈仍然是黑色。
帮助。
答案 0 :(得分:2)
问题是你提供了一个没有补丁可以满足的条件。 (例如,它不能同时位于彩色色块的左侧和右侧,但您使用and
。)以下内容是否满足您的需求?
to colorPatches
ask patch 0 0 [
set pcolor red
ask neighbors [ set pcolor blue]
]
ask patches with [pcolor = black] [
set pcolor green
]
end