Maze Generator and Solver
This Maze Project was the first project I made at Galvanize. It's a maze generator and solver, written in vanilla HTML and Javascript. I wrote the maze-solving algorithm a few years ago, so the first part of the project was just a matter of rewriting it in Javascript instead of Java, getting the maze to display in the DOM, and having it solve and display user-created mazes. I then wrote a depth-first maze generation algorithm, which essentially takes random paths until it creates a dead end, then goes back and tries a different direction. This method worked really well at generating neat mazes. I then tried a method of generation using cellular automata, but this was less effective. If the rules favored impassable cells the maze wasn’t solvable; if it favored passable ones, it was too easy, whereas a depth-first maze was always solvable. I also added a visualization for the solving and generation algorithms. The maze-solving algorithm works by assigning every spot next to the goal a value of 1, every spot next to a 1 a 2, and so on, then to find a path, choosing a spot with a lower value than the current one. So to visualize this, each cell is given a color value based on its distance to the goal. The depth visualization colors each cell based on when it was changed to passable — the later the darker.
Open Project