title: Algorithm to find the shortest path in a matrix
body: <p>I tried to find an algorithm for the following problem, but I couldn't.</p>
  
  <p>you have a matrix, 10X6 if it matters. (10 on x dimension 6 on y dimension).
  the algorithm receives 2 point, the opening point and the target point.
  the array is full of 0's and 1's and it should find the shortest path of 1's between them, and return the first point in this path (the next point in the way to the target).
  But here's the catch:</p>
  
  <p>each point can get the value only of the following points:</p>
  
  <ol>
  <li>the point above it. </li>
  <li>the point underneath it. </li>
  <li>the point left to it. </li>
  <li>the point right to it.</li>
  </ol>
  
  <p>and to make things even harder: for every point, the value of other point may be different. for example:</p>
  
  <ol>
  <li>the opening point is 0,0. the value of 0,1 is 1;</li>
  <li>the opening point is 0,2. the value of 0,1 is 0.</li>
  </ol>
  
  <p>I can calculate the value so it shouldn't matter for you...
  So I thought the only way to solve it is with recursion because of the last condition but if you find another way, you're welcome.</p>
  
  <p>The solution should be in <strong>LUA</strong>, <strong>C#</strong> or <strong>JAVA</strong>.</p>