# Engineering

# Blueprints

# Random Maze Generator Blueprints

Maze Generator

# The random maze generator uses the recursive backtrack algorithm, which repeats itself until it's unable to complete a step in generating the maze. When finding a valid tile to add to the maze, the algorithm checks two tiles away to make sure the path is not completely blocked. When the current tile doesn't have any valid tiles to move, the algorithm starts to backtrack. The repetition of this process grows the path and eventually generates a random maze.

# â€‹

# â€‹

# The maze uses a grid to determine where the maze walls should be placed. In order to do so, the grid has to be numbered so that the boarder walls can be differentiated.

# â€‹

# The maze also needs to know how to get the numbers of neighboring tiles so the walls can be placed accordingly

# Grid numbering equation:

# Top Row = l

# Right Column = (ix) + (x-1)

# Bottom Row = (x-1)x) + l

# Left Column = ix

# Neighboring grid number equation:

# North = c - 2x

# East = c + 2

# South = c + 2x

# West = c - 2

# Maze: Construction Script

# Maze: Functions

# Maze: Macros