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 :

enter image description here

i have blue rectangles follows:

enter image description here

by using color-white-patches-v2 [ c ] in how replace color color in polygon, obtain figure :

enter image description here

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:

enter image description here

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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -