12#include <unordered_map>
26 void build_fut(std::vector<int>
const& indices)
noexcept;
32 mutable std::promise<bool> m_config_promise;
33 std::mutex m_cells_mutex;
34 std::unordered_map<int, std::shared_ptr<cell>> m_cells;
46 explicit grid(
unsigned int rows = 1u,
unsigned int columns = 1u,
unsigned int height = 1u);
50 explicit grid(std::tuple<unsigned int, unsigned int, unsigned int> dimensions);
82 virtual std::tuple<
unsigned int,
unsigned int,
unsigned int>
get_dimensions() const noexcept override;
86 virtual
void to_vec(std::vector<std::shared_ptr<
cell>>& cells) const noexcept override;
90 virtual
void to_vec2(std::vector<std::vector<std::shared_ptr<
cell>>>& cells) const noexcept override;
95 virtual std::optional<std::
string>
contents_of(const std::shared_ptr<
cell>& c) const noexcept override;
113 std::function<
int(
unsigned int,
unsigned int)> m_calc_index;
115 std::tuple<
unsigned int,
unsigned int,
unsigned int> m_dimensions;
Binary tree algorithm for generating mazes.
Definition binary_tree.h:18
Cell class for maze generation.
Definition cell.h:14
Depth-first search algorithm for generating mazes.
Definition dfs.h:19
Interface for the grid class.
Definition grid_interface.h:26
General purpose grid class for maze generation.
Definition grid.h:21
grid(const grid &other)
Copy constructor.
virtual std::tuple< unsigned int, unsigned int, unsigned int > get_dimensions() const noexcept override
Provides dimensions of grid in no assumed ordering.
virtual void to_vec(std::vector< std::shared_ptr< cell > > &cells) const noexcept override
Convert a 2D grid to a vector of cells (sorted by row then column)
void build_fut(std::vector< int > const &indices) noexcept
Builds a future based on the provided indices.
int count() const noexcept
Get the count of cells in the grid.
virtual std::future< bool > get_future() noexcept
Initialize and configure.
grid & operator=(const grid &other)
Assignment operator.
grid & operator=(grid &&other) noexcept
Move assignment operator.
virtual std::optional< std::string > contents_of(const std::shared_ptr< cell > &c) const noexcept override
Get detailed information of a cell in the grid.
grid(unsigned int rows=1u, unsigned int columns=1u, unsigned int height=1u)
Constructor for grid.
virtual std::optional< std::uint32_t > background_color_for(const std::shared_ptr< cell > &c) const noexcept override
Get the background color for a cell in the grid.
void configure_cells(std::vector< std::shared_ptr< cell > > &cells) const noexcept
Configure cells by neighbors (N, S, E, W)
virtual ~grid()
Destructor.
grid(grid &&other) noexcept
Move constructor.
grid(std::tuple< unsigned int, unsigned int, unsigned int > dimensions)
Constructor for grid.
virtual void to_vec2(std::vector< std::vector< std::shared_ptr< cell > > > &cells) const noexcept override
Convert a 2D grid to a vector of vectors of cells (sorted by row then column)
std::shared_ptr< cell > search(int index) const noexcept
Sidewinder algorithm for generating mazes.
Definition sidewinder.h:17
Namespace for the maze builder.
Definition algo_interface.h:9