Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Generate random labyrinths
ResourceFunction["RandomLabyrinth"][n] generates a random labyrinth based on n × n grid graph. | |
ResourceFunction["RandomLabyrinth"][{m,n}] generates a random labyrinth based on a grid graph with m rows and n columns. | |
ResourceFunction["RandomLabyrinth"][size,prop] gives the specified property prop for the labryinth. |
Make a random rectangular grid labyrinth:
| In[1]:= |
| Out[2]= | ![]() |
Make a random hexagonal grid labyrinth:
| In[3]:= |
| Out[3]= | ![]() |
RandomLabyrinth can be given different properties:
| In[4]:= |
| Out[4]= |
If the properties argument is All, then an association with all properties is returned:
| In[5]:= |
| Out[5]= | ![]() |
The option "GridLayout" specifies the type grid graphs used to make the labyrinth. It takes the values "Rectangular" and "Hexagonal":
| In[6]:= |
| Out[6]= | ![]() |
Make a rectangular grid labyrinth and show it together with a solution:
| In[7]:= |
| Out[8]= | ![]() |
Make a hexagonal grid labyrinth and show it together with a solution:
| In[9]:= | ![]() |
| Out[10]= | ![]() |
Generate 100 labyrinths:
| In[11]:= | ![]() |
| Out[12]= |
Show the histogram of the shortest path solution lengths:
| In[13]:= |
| Out[13]= | ![]() |
Show the labyrinths with the smallest and largest shortest paths solutions:
| In[14]:= |
| Out[14]= | ![]() |
For larger size values the labyrinth generation might be slow, especially, for hexagonal labyrinths:
| In[15]:= |
| Out[15]= | ![]() |
The making of rectangular labyrinths with same size parameters is faster:
| In[16]:= |
| Out[16]= | ![]() |
Larger rectangular grid maze:
| In[17]:= | ![]() |
| Out[18]= | ![]() |
A larger hexagonal grid maze with its largest connected components colored:
| In[19]:= | ![]() |
| Out[21]= | ![]() |
A grid of tiny labyrinths:
| In[22]:= | ![]() |
| Out[23]= | ![]() |
Wolfram Language 13.0 (December 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License