使用NetLogo上的开关重置补丁



我需要一些帮助来解决一个疑问。我有5种颜色的补丁,蓝色,橙色,红色,绿色和黄色。如果启用了开关(界面中名为show?(,我希望橙色和红色补丁处于非活动状态。我正在执行以下代码(如下(。但它不起作用。一切都一样。有人能帮我吗?谢谢

to test
if show? = false [
ask patches with [pcolor = orange and pcolor = red ] [
set pcolor black
set plabel "" ]
]
if show? = true [ color-map ] ;; color-map is procedure with the 5 patches colors
end

有一个小的逻辑错误:补丁不能pcolor = orange and pcolor = red

只需将and替换为or

最新更新