title: Netlogo : change patch color of one patch if orthogonal neighbors have the same color
body: <p>I'm new to netlogo and I need some help.</p>
  
  <p>I am trying to grow a continuous patch of one color (green on a black background). However, I will sometimes have a black patch that is completely surrounded by green patches. I would like to change the color of those black patches to green.</p>
  
  <p>I tried :</p>
  
  <pre><code>ask patches [
      if neighbors4 with [pcolor = 55] 
      [set pcolor 55]
    ]
  </code></pre>
  
  <p>but it gives me an error, as does</p>
  
  <pre><code>ask patches [
      if any? neighbors4 [pcolor = 55] 
      [set pcolor 55]
    ]
  </code></pre>
  
  <p>Here is the code that works that will sometimes leave black patches surrounded by green patches : </p>
  
  <pre><code>to setup
    clear-all
    set-patch-size 4
    resize-world -50 50 -50 50
    ask patches[set pcolor black]
    grow-cell
    reset-ticks
  end
  
  to grow-cell
      ask patch 0 0 [ 
      set pcolor 55
      ask neighbors [ 
      set pcolor 55
      ]
    ]
    repeat 45 
    [ ask patches with [pcolor = black]
      [ set pcolor [pcolor] of one-of neighbors4 ] ]
  end
  </code></pre>