-
Notifications
You must be signed in to change notification settings - Fork 0
/
Maze.h
76 lines (66 loc) · 1.61 KB
/
Maze.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// John Leeds
// 3/2/2022
// Maze.h
#include <vector>
#ifndef MAZE_H
#define MAZE_H
void setSeed();
int ranNum(int, int);
class MazeCell{
public:
MazeCell();
int getVisitStatus();
bool getUp();
bool getRight();
bool getDown();
bool getLeft();
void setVisitStatus(int val);
void setUp(bool val);
void setRight(bool val);
void setDown(bool val);
void setLeft(bool val);
private:
int visitStatus;
bool up;
bool right;
bool down;
bool left;
};
class Maze{
public:
/*
* Constructor
* Creates a maze of unvisited MazeCells, all with 4 walls
*/
Maze(int length, int height);
/*
* clearVisitStatus
* Sets the visit status of every maze cell to unvisited (0)
*/
void clearVisitStatus();
/*
* generate
* Creates a maze with a depth-first search
*/
void generate(bool print);
/*
* checkNeighbors
* Returns true if there is a neighbor that has not been visited
*/
std::vector<std::vector<int>> checkNeighbors(int x, int y);
void analyzeCell(int x, int y);
/*
* solve
* Solves the maze
*/
void solve(bool print);
std::vector<int> pickMove(int x, int y);
/*
* show
* Prints a visual representation of the maze to the consul
*/
void show();
private:
std::vector<std::vector<MazeCell>> myMaze;
};
#endif