title: How would one find the "coastline" of an object stored in a 2D list using Python?
body: <p>I'm trying to create a survival roguelike game using Python and the CMD terminal.
  I have a 2 dimensional list that contains a continent and some separate islands.
  What I need is to find the outline of each object - like so:</p>
  <pre><code>#########     [1,1,1,1,1,1,1,1,1,0],
  #.......#     [1,0,0,0,0,0,0,0,1,0],
  #.###...#     [1,0,1,1,1,0,0,0,1,0],
  #.# #...#     [1,0,1,0,1,0,0,0,1,0],
  #.###...##    [1,0,1,1,1,0,0,0,1,1],
  ##.......#    [1,1,0,0,0,0,0,0,0,1],
   #########    [0,1,1,1,1,1,1,1,1,1]
  
     island             data
  </code></pre>
  <p>where &quot;#&quot; is the coastline, &quot;.&quot; is land and &quot; &quot; is water.
  I think it's possible to somehow use a flood-fill algorithm to find the edges of the continent/islands, but I have no idea how flood-fill algorithms are implemented in Python or how to make one.</p>
  <h2>Thanks.</h2>
  <p>EDIT 1:</p>
  <p>My plan is to create &quot;beach&quot; areas, requiring me to track coastlines.
  An area in game is a 2D list, and <strong>right now</strong> it can be represented by 0 (false/water) and 1 (true/land). I want to create 2 (beach).</p>
  <pre><code> area = [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
           [0,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
           [0,1,0,1,1,1,1,1,1,1,1,0,0,0,0],
           [0,1,1,1,1,1,1,1,0,0,0,0,0,0,0],
           [0,0,0,0,0,0,1,1,1,0,0,0,0,0,0]] # This is right now.
  </code></pre>
  <p>compared to</p>
  <pre><code>area = [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
          [0,2,2,2,2,2,2,2,2,2,2,2,2,2,2],
          [0,2,0,2,1,1,1,1,2,2,2,0,0,0,0],
          [0,2,2,2,2,2,1,2,0,0,0,0,0,0,0],
          [0,0,0,0,0,0,2,2,2,0,0,0,0,0,0]] # This where I want to be 
  </code></pre>
  <p>(these weren't full maps)</p>