Jul 2022

MazeCan you find your way?


The generated maze will be 'perfect', as in every point can be reached from every point.

  1. Pick a random cell (center), set cell as taken and put on the stack.
  2. Look at the last item in the stack. (blue, number is length on stack)
  3. Pick a neighbour empty(dark) cell, at random. (green)
  4. Is one available?
    • Yes: Add neighbour cell to the stack. - Set cell as taken. - Basically we "dig" through the walls into this cell.
    • No: Remove the last item from the stack. - We never "dig" into a previously made tunnel, only out of.
  5. If there are items in the stack, go to 2

Walkers use the "left-hand-rule". Touch the wall with your left hand and keep following it.