10 #include "screenBuffer.h" 56 if (neighbors.find(direction) != neighbors.end()) {
57 throw std::runtime_error(
"Neighbor already exists in the given direction.");
60 neighbors[direction] = node;
68 if (neighbors.find(direction) == neighbors.end()) {
69 throw std::runtime_error(
"Neighbor not found in the given direction.");
72 neighbors.erase(direction);
81 auto neighbor = neighbors.find(direction);
82 return (neighbor != neighbors.end()) ? neighbor->second :
nullptr;
123 std::map<std::pair<int, int>,
MazeNode*> mazeMape;
131 void generateMaze(
int width,
int height);
146 Maze(
int width,
int height);
MazeNode * getNeighbor(Direction direction) const
Get the neighboring node in a given direction.
Definition: maze.h:80
std::map< Direction, MazeNode * > getNeighbors() const
Get all neighboring nodes.
Definition: maze.h:89
NodeType
An enumeration of the different types of nodes in the maze.
Definition: maze.h:18
std::map< Direction, MazeNode * > neighbors
Definition: maze.h:42
bool setNodeType(NodeType type)
Set the piece type of the node.
Definition: maze.h:107
bool removeNeighbor(Direction direction)
Remove a neighboring node with a direction.
Definition: maze.h:67
void addNeighbor(MazeNode *node, Direction direction)
Add a neighboring nodes with a direction.
Definition: maze.h:55
MazeNode()
Default constructor for MazeNode.
Definition: maze.h:48
NodeType getNodeType() const
Get the piece type of the node.
Definition: maze.h:98
A struct that reprsents the nodes in the graph of the maze.
Definition: maze.h:40
NodeType type
Definition: maze.h:41
A class that represents the maze game.
Definition: maze.h:119