Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 935 Bytes

README.md

File metadata and controls

39 lines (28 loc) · 935 Bytes

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

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