Maze Builder Docs 6.3.5
Loading...
Searching...
No Matches
lab.h
Go to the documentation of this file.
1#ifndef LAB_H
2#define LAB_H
3
4#include <optional>
5#include <utility>
6#include <tuple>
7#include <unordered_map>
8
10
12namespace mazes {
13
14class cell;
15class maze;
16
18
22class lab {
23public:
24 explicit lab();
25
26 // Destructor
27 ~lab();
28
29 // Copy constructor
30 lab(const lab& other);
31
32 // Copy assignment operator
33 lab& operator=(const lab& other);
34
35 // Move constructor
36 lab(lab&& other) noexcept = default;
37
38 // Move assignment operator
39 lab& operator=(lab&& other) noexcept = default;
40
41 std::optional<std::tuple<int, int, int, int>> find(int p, int q) const noexcept;
42 std::optional<std::tuple<int, int, int, int>> find(int p, int q, int r) const noexcept;
43
44 void insert(int x, int y, int z, int w) noexcept;
45
46 bool empty() const noexcept;
47
48 int get_levels() const noexcept;
49 void set_levels(int levels) noexcept;
50
51 int get_random_block_id() const noexcept;
52
57 static void link(const std::shared_ptr<cell>& c1, const std::shared_ptr<cell>& c2, bool bidi = true) noexcept;
58
63 static void unlink(const std::shared_ptr<cell>& c1, const std::shared_ptr<cell>& c2, bool bidi = true) noexcept;
64private:
65
66 using pqmap = std::unordered_map<std::pair<int, int>, std::tuple<int, int, int, int>, pair_hash>;
67 pqmap m_p_q;
68
69 int levels;
70};
71}
72
73#endif // LAB_H
Cell class for maze generation - only stores its index and links to other cells.
Definition cell.h:17
Holds mazes and provides search functions.
Definition lab.h:22
static void link(const std::shared_ptr< cell > &c1, const std::shared_ptr< cell > &c2, bool bidi=true) noexcept
Links two cell objects, optionally in both directions.
static void unlink(const std::shared_ptr< cell > &c1, const std::shared_ptr< cell > &c2, bool bidi=true) noexcept
Unlinks two cell objects, optionally in both directions.
Namespace for the maze builder.
Definition algo_interface.h:9
Hashing function to store a block's (x, z) position.
Definition hash_funcs.h:30