Tidy Maze Maker‎ > ‎Maze Generation‎ > ‎

GenerateMaze

Creates a BlockMap with which you may realize your wildest Block-mapping dreams.

Definition:

static bool[,] GenerateMaze(int width, int height, MazeType mazeType)

Example:

//This will generate a maze and output its contents (where x = wall and . = emptiness)

bool[,] mazeResult;

int width = 20;
int height = 20;l
MazeType mazeType = MazeType.Prims;

mazeResult = MazeGenerator.GenerateMaze(width,height,mazeType);

for(int y = 0; y < height; y++){
    for(int x = 0; x < width; x++){

        if(mazeResult[x,y]){
            Debug.Log("x");
        }
        else{
            Debug.Log(".");
        }

    }
}


Return value Description
bool[,] A 2D array of boolean values, indicating whether a coordinate is full or empty

Argument DataType Description
width     int The width of the map you wish to create - measured in Cells. A 'cell' is represented by one block with a block space on each side (shared with neighbour cells). This results in maps approximately twice the width (in blocks) as the cells you input.
height int The height of the map you wish to create - measured in Cells. A 'cell' is represented by one block with a block space on each side (shared with neighbour cells). This results in maps approximately twice the width (in blocks) as the cells you input.
mazeType MazeType The type of map you wish to create: Either MazeType.RecursiveBacktracker or MazeType.Prims

Comments