title: Solving a maze with only vision of a 15x15 grid around the current square (C++)
body: <p>So I'm writing a program that solves a maze in the fastest time possible but you're only given a small area around where you currently are to see the surrounding area. I had planned to make it so that it always steps in the order of right > forward > left > backward. To make it go faster I intended to add a function that checks a path to see if it results in a dead end. Whether or not you can go in a certain direction is represented by the last 4 digits. I tried using a breadth first search algorithm to find dead ends. The function works by checking to see if it steps outside of the given area and if it does it returns false, otherwise it returns true. I'm not entirely sure where it's going wrong but it definitely does not work. The function is passed an array that represents the visible area, the height and width of the area, the x,y  coordinates and the direction it is originally facing represented as a unsigned char. this is &amp; with the last 4 bits to check if it's possible to move in that direction. Any help would be appreciated.</p>
  
  <pre><code>//WILL RETURN TRUE IF THERE IS A DEAD END, FALSE OTHERWISE
   bool ActualPlayer::deadEnd(const AdvancedMapTile* area, const uint width, const uint height, const uint x, const uint y, unsigned char dir)
  {
  //dynamic allocation
  bool *marked = nullptr;
  marked = new bool[height * width];
  for(uint i = 0; i &lt; (height * width) ; i++)
      marked[i] = false;
  queue&lt;cord&gt; q;
  bool deadEnd = true;
  cord temp;
  
  marked[x + y*width] = true;
  temp.x = x;
  temp.y = y;
  q.push(temp);
  //perform bfs
  while(!q.empty())
  {
      AdvancedMapTile loc = area[x + y*width];
      temp = q.front();
      q.pop();
      for(unsigned char i = 1; i &lt; 9; i = i*2)//goes for 1, 2, 4, 8
      {
          uint tempx = temp.x;
          uint tempy = temp.y;
          changeXY(tempx, tempy, i, height, width);
          if(!marked[tempx + tempy*width] &amp;&amp; (loc.exits &amp; i) != 0)
          {
              q.push(temp);
              marked[tempx + tempy*width] = true;
              if(tempx &lt; 0 || tempx == width || tempy &lt; 0 || tempy == height)
                  return false;
          }
      }
  }
  
  delete [] marked;
  return deadEnd;
  </code></pre>
  
  <p>}</p>