Pregunta

How can I draw in red the patches situated in crossroads (the roads are drawn in white) as in the figure below ?

Here is my beginning of code:

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

Thanks in advance for your help.

enter image description here

¿Fue útil?

Solución

How about this? (Assuming roads are one patch in width and are always horizontal or vertical.)

ask patches with [all? neighbors4 [pcolor = white]] [set pcolor red]
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top