title: Skyscraper puzzle algorithm
body: <p>I'm writing an algorithm to solve <a href="http://www.puzzlemix.com/Skyscraper" rel="nofollow noreferrer">skyscrapers puzzles</a>:</p>
  <blockquote>
  <p>Skyscraper puzzles combine the row and column constraints of Sudoku with external clue values that re-imagine each row or column of numbers as a road full of skyscrapers of varying height. Higher numbers represent higher buildings.</p>
  <p>To solve a Skyscraper puzzle you must place 1 to 5, or 1 to whatever the size of the puzzle is, once each into every row and column, while also solving each of the given skyscraper clues.</p>
  <p>To understand Skyscraper puzzles, you must imagine that each value you place into the grid represents a skyscraper of that number of floors. So a 1 is a 1-floor skyscraper, while a 4 is a 4-floor skyscraper. Now imagine that you go and stand outside the grid where one of the clue numbers is and look back into the grid. That clue number tells you how many skyscrapers you can see from that point, looking only along the row or column where the clue is, and from the point of view of the clue. Taller buildings always obscure lower buildings, so in other words higher numbers always conceal lower numbers.</p>
  </blockquote>
  <p>All the basic techniques are implemented and working, but I've realized that with bigger puzzles (5x5&gt;) I need some sort of recursive algorithm. I found a decent working <a href="http://pastebin.com/wxuiBt57" rel="nofollow noreferrer">python script</a>, but I'm not really following what it actually does beyond solving basic clues.</p>
  <p>Does anyone know the proper way of solving these puzzles or can anyone reveal the essentials in the code above?</p>