title: Is there an algorithm to dynamical generate a maze, ensuring that there is always more places to go?
body: <p>Let's suppose we have a maze. You start somewhere in it:</p>
  
  <pre><code>* - * - * 
      |   |
      *-here
  </code></pre>
  
  <p>Only a small part of the maze is generated (for example, a 10 by 10 square around you). As you move around, more of the maze is generated. Is there an algorithm that ensures that there is always a place for you to go? </p>
  
  <p>For example:</p>
  
  <pre><code> *-here  * - *
               |
               *
  </code></pre>
  
  <p>would not work because you have no paths.</p>
  
  <p>I have a 'solution' for it, and that is to generate a finite maze, then force it to be connected to another finite maze, forming a mesh (ensuring that finite mazes are doable is easy).</p>
  
  <p>Edit 1: The maze can't have a deterministic size; Parts of the map will be generated dynamically. </p>
  
  <p>Edit 2: It has to generate the same maze no matter the order which you load it in (Moving up then left should generate the same maze as moving left then up)</p>
  
  <p>My maze does not need to include all places</p>
  
  <p>example image:<a href="https://i.stack.imgur.com/iTfx3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iTfx3.png" alt="enter image description here"></a></p>