Generates a random maze using depth-first search. Red cell is the current cell, blue is the top of the stack: where it’ll jump to if it gets to a cell with no unvisited neighbors.
This code actually comes from another project I was working on to make a tilt labyrinth type of game. Still messing with it, need to get the collision detection working better (any updates on the physics lib btw?) I pulled out this code and used coroutines to make it so the maze generation could be watched. The slider will slow down the speed. Also in the setup method you can change the size variable to make bigger or smaller mazes.