title: Algorithm to find shortest path through wall
body: <p>I am writing an AI for a text-based game and the problem I have is that I am stuck on how to determine the thinnest section of wall. For example the following represents the 2D map, where '^' is the character who wants to get through a wall represented by '*' characters to the location marked 'X':</p>
  
  <pre><code>------------------
  |  X *           |
  |*****           |
  |****            |
  |***             |
  |**      ^       |
  |                |
  |                |
  |                |
  ------------------
  </code></pre>
  
  <p>I've been thinking about this one for a couple days straight now and I've run out of ideas. I've tried using a* algorithm where when it tries to go through a wall character the g-cost made very high. Unfortunately the algorithm decides to never path-find through the wall.</p>
  
  <p>The agent can only move left-right-up-down and not diagonally, one space at a time.</p>
  
  <p>The shortest path in the above example through the wall is one, as it only has to travel through one '*' character.</p>
  
  <p>I just need a couple simple ideas :)</p>