-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmazehandling.h
59 lines (42 loc) · 1.18 KB
/
mazehandling.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
#ifndef MAZEHANDLING_H_
#define MAZEHANDLING_H_
#include <QWidget>
#include <vector>
class Cell;
typedef std::pair<char, Cell*> NEIGHBOR_INFO;
typedef std::vector<std::vector<Cell*>> MAZEDATA;
class MazeHandling : public QWidget
{
public:
enum eSOLVEMAZE_TYPE
{
SOLVEMAZE_DFS,
SOLVEMAZE_BFS
};
explicit MazeHandling(QWidget* parent = nullptr);
~MazeHandling() override;
void setSolveMazeType(eSOLVEMAZE_TYPE eSolveMazeType);
void generateMazeData();
void solveMazeData();
protected:
void paintEvent(QPaintEvent*) override;
private:
void releaseMazeData();
void resetVisitedFlag();
void carveDFS();
NEIGHBOR_INFO getRandomGenNeighborDir(Cell* cell);
void solveDFS();
void solveBFS();
NEIGHBOR_INFO getRandomSolveNeighborDir(Cell* cell);
void getAvailableSolveNeightbors(Cell* cell, std::vector<Cell*>& listCell);
private:
MAZEDATA m_arrayMazeData;
bool m_bMazeDataAvailable;
std::vector<Cell*> m_pathSolvedData;
std::vector<Cell*> m_pathTraversedData;
bool m_bSolveDataAvailable;
Cell* m_pStartCell;
Cell* m_pEndCell;
eSOLVEMAZE_TYPE m_eSolveMazeType;
};
#endif // MAZEHANDLING_H_