如何绘制位于十字路口的补丁?

时间:2014-07-30 00:06:04

标签: netlogo

如何在红色中绘制位于十字路口的斑块(道路以白色绘制),如下图所示?

这是我的代码开头:

ask patches with [ (pcolor = white) and (pxcor mod (nb-patch-length + 1) = 0 ) and (pycor mod (nb-patch-width + 1) = 0 ) ] [set pcolor red] 

提前感谢您的帮助。

enter image description here

1 个答案:

答案 0 :(得分:2)

这个怎么样? (假设道路宽度为一个补丁,并且始终是水平或垂直的。)

ask patches with [all? neighbors4 [pcolor = white]] [set pcolor red]