Dungeonator  1.0.0
a dungeon generator library
Functions
maze.h File Reference

the implementation file for maze generation code More...

#include "direction.h"
#include "grid.h"
#include "util.h"

Go to the source code of this file.

Functions

void backtrackMaze (Grid *grid, regions_t regions, int x, int y, int region)
 

Detailed Description

the implementation file for maze generation code

the implementation file for maze generation code, currently only implementing recursive backtracking

Function Documentation

◆ backtrackMaze()

void backtrackMaze ( Grid grid,
regions_t  regions,
int  x,
int  y,
int  region 
)

run recursive backtracking (aka depth-first search) on a grid to generate a maze

Parameters
[in,out]gridthe grid to run the algorithm on
[in]regionsthe regions array
[in]xthe starting x position for backtracking
[in]ythe starting y position for backtracking
[in]regionthe region of the maze
Warning
can cause stack overflow if a grid is too large
Todo:
create stack based implementation to prevent this problem?