I would like to invite anyone interested in mazes to use my maze paclet NewMazePaclet. I love mazes.
​
Below, the tech note I wrote for the paclet.
Create a grid graph.
In[]:=
gridGraph=GridGraph[{8,8}]
Out[]=
Create a triangular grid graph.
In[]:=
triangularGridGraph=TriangularGridGraph[{8,8}]
Out[]=
Create a hexagonal graph.
In[]:=
hexagonalGridGraph=HexagonalGridGraph[{8,8}]
Out[]=
Make a maze for each type of grid.
square grid:
In[]:=
gridMaze=MakeMaze[gridGraph]
Out[]=
Triangular grid:
In[]:=
triangularMaze=MakeMaze[triangularGridGraph]
Out[]=
Hexagonal grid:
In[]:=
hexagonalMaze=MakeMaze[hexagonalGridGraph]
Out[]=
The main function of the paclet is SolveMaze. Solve the mazes.
Square maze solution:
In[]:=
squareMazeSolution=SolveMaze[gridMaze]
Out[]=
Triangular maze solution:
In[]:=
triangularMazeSolution=SolveMaze[triangularMaze]
Out[]=
Hexagonal maze solution:
In[]:=
hexagonalMazeSolution=SolveMaze[hexagonalMaze]
Out[]=
There's also a function that will generate an equilateral triangle.
Make a maze:
Solve the maze:
The problem with this function is it doesn't regularly tile the plane. You can't specify a different width and height, which you can do with TriangularGridGraph.
You can only generate a 12 equilateral triangle or a 24 equilateral triangle.
You can represent a maze with a tree:
You can contract the edges of the tree of the graph.
A maze is an acyclic tree. Reduce the graph.