4#include <unordered_map>
17class distances :
public std::enable_shared_from_this<distances> {
34 return m_cells.at(
cell);
39 void set(std::shared_ptr<cell>
cell,
int distance)
noexcept;
46 std::shared_ptr<distances>
path_to(std::shared_ptr<cell> goal)
const noexcept;
49 std::pair<std::shared_ptr<cell>,
int>
max() const noexcept;
59 std::shared_ptr<
cell> m_root;
60 std::unordered_map<std::shared_ptr<
cell>,
int> m_cells;
Cell class for maze generation.
Definition cell.h:14
Distances utility class for counting paths and nodes.
Definition distances.h:17
std::shared_ptr< distances > dist() const noexcept
Returns a shared pointer to a distances object.
std::shared_ptr< distances > path_to(std::shared_ptr< cell > goal) const noexcept
Computes the shortest path to a goal cell within a distances object.
std::pair< std::shared_ptr< cell >, int > max() const noexcept
Computes the maximum distance and cell in a distances object.
bool contains(const std::shared_ptr< cell > &cell) const noexcept
Checks if a given cell is contained in the distances object.
void collect_keys(std::vector< std::shared_ptr< cell > > &cells) const noexcept
Collects keys from a vector of shared pointers to cell objects.
distances(std::shared_ptr< cell > root)
Constructor that initializes the distances object with a given root cell.
const int & operator[](const std::shared_ptr< cell > &cell) const noexcept
Accesses the value associated with a given cell in a shared pointer.
Definition distances.h:33
void set(std::shared_ptr< cell > cell, int distance) noexcept
Sets the distance of a cell in the distances object.
int & operator[](const std::shared_ptr< cell > &cell) noexcept
Overloaded operator to access the distance of a cell.
Definition distances.h:26
Namespace for the maze builder.
Definition algo_interface.h:9