100-days-of-rust/Week-03/Day-21_Random-Maze-Generator/README.md
2023-03-23 20:52:21 -04:00

932 B

Random Maze Generator

A maze can be generated by starting with a predetermined arrangement of cells with wall sites between them. This predetermined arrangement can be considered as a connected graph with the edges representing possible wall sites and the nodes representing cells. The purpose of the maze generation algorithm can then be considered to be making a sub-graph in which it is challenging to find a route between two particular nodes.

Given an input, generate a random Maze.

Examples

Example 1

DrawMaze(5,7)

Output

Maze

Example 2

DrawMaze(4,6)

Output

+---+---+---+---+---+---+
|   |           |       |
+   +   +   +---+   +---+
|   |   |           |   |
+   +   +---+---+---+   +
|   |   |               |
+   +   +   +---+---+   +
|           |           |
+---+---+---+---+---+---+