#include <prims_generator.hxx>
Classes | |
struct | CellInfo |
Public Types | |
typedef Grid< CellInfo > | Maze |
typedef Maze::Cell | Cell |
typedef Maze::Point | Point |
Public Member Functions | |
std::unique_ptr< Maze > | operator() (const uint32_t width, const uint32_t height, const Point &startPoint=Point(0, 0), const uint32_t seed=0) |
Static Public Member Functions | |
static std::vector< std::shared_ptr< Cell > > | GetNeighbours (const Maze &maze, const Cell &cell, const bool visited) |
Detailed Description
Prim's Generator - Generate a maze using a Depth First Search (Prims) strategy.
Prim's Maze Generator is a randomized version of Prim's algorithm: a method for producing a minimal spanning tree for a undirected weighted graph.
Prim's algorithm creates a tree by getting the adjacent cells and finding the best one to travel to next. To Generate mazes using Prim's, we will instead take a random cell to travel to the next one.
Although the classical Prim's algorithm keeps a list of edges, here is studied the modified version for our maze generation by maintaining a list of adjacent cells. Running faster, it still requires storage proportional to the size of the Maze.
- Parameters
-
width desired width for the maze. height desired height for the maze. startPoint possible point to start the algorithm, {x: 0, y: 0} by default. seed number used to initiate the random generator, 0 by default.
- Returns
- Operator() returns Maze Grid pointer to be owned, nullptr if construction failed.
Definition at line 52 of file prims_generator.hxx.
Member Typedef Documentation
Definition at line 59 of file prims_generator.hxx.
typedef Grid<CellInfo> huc::maze::PrimsGenerator::Maze |
Definition at line 58 of file prims_generator.hxx.
Definition at line 60 of file prims_generator.hxx.
Member Function Documentation
|
inlinestatic |
GetNeighbours - Retrieve available neighbours
- Parameters
-
maze Grid within the search occurs cell Cell of which neighbours will be found. visited select whether or (and only or) not cells that are visited
- Returns
- vector of neighbours, empty vector if none.
Definition at line 107 of file prims_generator.hxx.
|
inline |
Definition at line 62 of file prims_generator.hxx.
The documentation for this class was generated from the following file: