Maze - JamesBremner/PathFinderJune2021 GitHub Wiki

Find path through a 2D grid maze

The generated mazes are specified in a text file using "ascii art".

format maze
+---+---+---+---+---+---+---+---+
|   |   |       |       |       |
+   +   +   +   +---+   +---+   +
|       |   |   |               |
+   +---+   +---+   +---+---+---+
|       |       |       | *   *  
+   +---+---+   +---+   +   +---+
  *   *         |     *   *     |
+---+   +---+---+---+   +---+---+
|     *   *   * | *   *         |
+   +---+---+   +   +---+---+   +
|       |     * | *     |       |
+---+---+---+   +   +---+---+---+
|       |     *   * |   |       |
+   +   +---+   +   +   +   +   +
|   |           |           |   |
+---+---+---+---+---+---+---+---+
'+' represents the corner of a cell
'|' represents a vertical wall between two cells
'---' represents a horizontal wall between two cells
'*' represents a cell visited on the solution path

The path through the maze is found using the Dijkstra algorithm.

Here is the graphviz representation of the maze graph

image

To generate solvable mazes, use an input file like this

format maze
gen -rows 5 -cols 5 binary -file mazgen.txt

The second line specifies the maze to generate

gen -rows "number of rows" -cols "number of columns" "algorithm" -file "output file"

The algorithm can be "binary" or "recursive"

binary tree algorithm https://en.wikipedia.org/wiki/Maze_generation_algorithm#Simple_algorithms

recursive division algorithm https://en.wikipedia.org/wiki/Maze_generation_algorithm#Recursive_division_method

⚠️ **GitHub.com Fallback** ⚠️