title: What algorithm should I implement to program a room cleaning robot?
body: <p>For this question assume that the following things are unknown:</p>
  
  <ul>
  <li>The size and shape of the room</li>
  <li>The location of the robot</li>
  <li>The presence of any obsticles</li>
  </ul>
  
  <p>Also assume that the following things are constant:</p>
  
  <ul>
  <li>The size and shape of the room</li>
  <li>The number, shape and location of all (if any) obsticles</li>
  </ul>
  
  <p>And assume that the robot has the following properties:</p>
  
  <ul>
  <li>It can only move forward in increments of absolute units and turn in degrees. Also the operation that moves will return true if it succeeded or false if it failed to move due to an obstruction</li>
  <li>A reasonably unlimited source of power (let's say it is a solar powered robot placed on a space station that faces the sun at all times with no ceiling)</li>
  <li>Every movement and rotation is carried out with absolute precision every time (don't worry about unreliable data)</li>
  </ul>
  
  <p>I was asked a much simpler version of this question (room is a rectangle and there are no obstacles, how would you move over it guaranteeing you could over every part at least once) and after I started wondering how you would approach this if you couldn't guarantee the shape or the presence of obstacles. I've started looking at this with <a href="http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm" rel="nofollow">Dijkstra's algorithm</a>, but I'm fascinated to hear how others approach this (or if there is a well accepted answer to this? (How does Roomba do it?)</p>