title: How to implement Man in Maze?
body: <p>i am thinking about design for such simple exercise as Man in Maze.</p>
  
  <p>I would like to make Maze object, put some Man objects inside it and call solve() for each to get out of Maze.
  Man should know nothing about Maze. It just can try to go and find way out.</p>
  
  <p>Here is how i see it:</p>
  
  <pre><code>    maze = Maze.new
  
      man1 = Man.new
      man2 = Man.new
      man3 = Man.new
  
      maze.put(man1,man2,man3)
  
      maze.men.each do |man| { man.solve }
  </code></pre>
  
  <p>But how to implement body of these classes?
  How can man know how to walk inside Maze unless I give Maze instance to him?
  But if i do that:</p>
  
  <pre><code>    maze.put(man1(maze),man3(maze),man2(maze))
  </code></pre>
  
  <p>What the reason to put men inside Maze if I can just give Maze instance to them?</p>
  
  <p>This is what i don't understand and can't find elegant solution.</p>