netlogo - How to replace color with another color in a rectangle? -
in same optic how replace color color in polygon, replace white patches contained in blue rectangles blue patches:
i have blue rectangles in figure below :
i have blue rectangles follows:
by using color-white-patches-v2 [ c ]
in how replace color color in polygon, obtain figure :
and using color-white-patches-v3 [ c ]
modified follows (because had error message of expected input turtle agentset or patch agentset or turtle or patch got nobody instead.
:
to color-white-patches-v3 [c] ask patches [ pcolor = white] [ if (patch-at 0 1 != nobody , [pcolor] of patch-at 0 1 = c) or (patch-at 1 0 != nobody , [pcolor] of patch-at 1 0 = c) [ set pcolor c ] ] end
i obtain:
i don't know how figure 2 , have code works different polygon shapes. help.
how this?
to color-white-patches ask patches [ pcolor = white , count neighbors4 [ pcolor = blue ] > 1 ] [ set pcolor blue ] end
this checks see if patches on @ least 2 sides blue. should work circumstances shown.
Comments
Post a Comment