title: Calculating distance in a 2D array, Non diagonal
body: <p>I have the following implemented in Java:</p>
  
  <pre><code>  [1,1][1,2][1,3][1,4]
    [2,1][2,2][ B ][2,4]
    [ A ][3,2][3,3][3,4]
  </code></pre>
  
  <p>I want to be able to calculate the Minimum distance between [ A ] and [ B ], without moving diagonally, i have searched online, but I'm not really sure how to word what I'm looking for. so far i have been able to calculate the diagonal distance using: </p>
  
  <pre><code>dMin = Math.min(dMin, Math.abs((xDistance - yDistance)));
  </code></pre>
  
  <p>Could some one please give me an algorithm i could look for online? any help is appreciated. thanks for you time :)</p>
  
  <p>Expected output is:</p>
  
  <pre><code>Distance = 3 //Not Distance = 2 (as it would be diagonally).
  </code></pre>