Maze Builder Docs 6.0.1
|
Cell class for maze generation. More...
#include <cell.h>
Public Member Functions | |
cell (std::int32_t index=0) | |
Constructs a cell object with an optional index. | |
void | link (std::shared_ptr< cell > c1, std::shared_ptr< cell > c2, bool bidi=true) |
Links two cell objects, optionally in both directions. | |
void | unlink (std::shared_ptr< cell > c1, std::shared_ptr< cell > c2, bool bidi=true) |
Unlinks two cells, optionally in both directions. | |
const std::unordered_map< std::shared_ptr< cell >, bool > & | get_links () |
Retrieves a constant reference to an unordered map of cell links and their boolean states. | |
bool | is_linked (const std::shared_ptr< cell > &c) |
Checks if a cell is linked. | |
bool | has_northern_neighbor () const noexcept |
Checks if the current object has a northern neighbor. | |
bool | has_southern_neighbor () const noexcept |
Checks if the current object has a southern neighbor. | |
bool | has_eastern_neighbor () const noexcept |
Checks if there is an eastern neighbor. | |
bool | has_western_neighbor () const noexcept |
Checks if there is a western neighbor. | |
std::vector< std::shared_ptr< cell > > | get_neighbors () const noexcept |
Retrieves a list of neighboring cells. | |
int32_t | get_index () const noexcept |
Retrieves the index of the current cell. | |
void | set_index (std::int32_t next_index) noexcept |
Sets the index to the specified value. | |
std::shared_ptr< cell > | get_north () const |
Retrieves a shared pointer to the cell located to the north. | |
std::shared_ptr< cell > | get_south () const |
Retrieves a shared pointer to the cell located to the south. | |
std::shared_ptr< cell > | get_east () const |
Retrieves a shared pointer to the cell located to the east. | |
std::shared_ptr< cell > | get_west () const |
Retrieves a shared pointer to the cell located to the west. | |
void | set_north (std::shared_ptr< cell > const &other) |
Sets the northern neighbor of the current cell. | |
void | set_south (std::shared_ptr< cell > const &other) |
Sets the southern neighbor of the current cell. | |
void | set_east (std::shared_ptr< cell > const &other) |
Sets the east neighbor of the current cell. | |
void | set_west (std::shared_ptr< cell > const &other) |
Sets the west neighbor of the current cell. | |
Cell class for maze generation.
|
explicit |
Constructs a cell object with an optional index.
index | The index to initialize the cell with. Defaults to 0. |
std::shared_ptr< cell > mazes::cell::get_east | ( | ) | const |
Retrieves a shared pointer to the cell located to the east.
|
noexcept |
Retrieves the index of the current cell.
const std::unordered_map< std::shared_ptr< cell >, bool > & mazes::cell::get_links | ( | ) |
Retrieves a constant reference to an unordered map of cell links and their boolean states.
|
noexcept |
Retrieves a list of neighboring cells.
std::shared_ptr< cell > mazes::cell::get_north | ( | ) | const |
Retrieves a shared pointer to the cell located to the north.
std::shared_ptr< cell > mazes::cell::get_south | ( | ) | const |
Retrieves a shared pointer to the cell located to the south.
std::shared_ptr< cell > mazes::cell::get_west | ( | ) | const |
Retrieves a shared pointer to the cell located to the west.
|
noexcept |
Checks if there is an eastern neighbor.
|
noexcept |
Checks if the current object has a northern neighbor.
|
noexcept |
Checks if the current object has a southern neighbor.
|
noexcept |
Checks if there is a western neighbor.
bool mazes::cell::is_linked | ( | const std::shared_ptr< cell > & | c | ) |
Checks if a cell is linked.
c | A shared pointer to the cell to check. |
Links two cell objects, optionally in both directions.
c1 | A shared pointer to the first cell object. |
c2 | A shared pointer to the second cell object. |
bidi | A boolean flag indicating if the link should be bidirectional. Defaults to true. |
void mazes::cell::set_east | ( | std::shared_ptr< cell > const & | other | ) |
Sets the east neighbor of the current cell.
other | A shared pointer to the cell that will be set as the east neighbor. |
|
noexcept |
Sets the index to the specified value.
next_index | The new index value to set. |
void mazes::cell::set_north | ( | std::shared_ptr< cell > const & | other | ) |
Sets the northern neighbor of the current cell.
other | A shared pointer to the cell that will be set as the northern neighbor. |
void mazes::cell::set_south | ( | std::shared_ptr< cell > const & | other | ) |
Sets the southern neighbor of the current cell.
other | A shared pointer to the cell that will be set as the southern neighbor. |
void mazes::cell::set_west | ( | std::shared_ptr< cell > const & | other | ) |
Sets the west neighbor of the current cell.
other | A shared pointer to the cell that will be set as the west neighbor. |
void mazes::cell::unlink | ( | std::shared_ptr< cell > | c1, |
std::shared_ptr< cell > | c2, | ||
bool | bidi = true ) |
Unlinks two cells, optionally in both directions.
c1 | A shared pointer to the first cell. |
c2 | A shared pointer to the second cell. |
bidi | A boolean indicating whether to unlink in both directions. Defaults to true. |