-
Notifications
You must be signed in to change notification settings - Fork 0
/
path_finder.h
53 lines (38 loc) · 1.01 KB
/
path_finder.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
#ifndef PATH_FINDER_H
#define PATH_FINDER_H
#include <string>
#include <vector>
#include <limits>
#include <stack>
#include <set>
#include <float.h>
#include <QVector>
#include <QDebug>
using namespace std;
typedef pair<int, int> Pair;
typedef pair<double, pair<int, int>> InfoPair;
struct Cell
{
int parent_i, parent_j;
double f, g, h; // f = g + h
};
class Path_finder
{
public:
Path_finder (QVector<QVector<int>> grid);
QVector<pair<int, int>> aStar(Pair src, Pair dest);
private:
int maze[31][28];
int ROW;
int COL;
QVector<pair<int, int>> tracePath(Cell cellTraceInfo[][28], Pair dest);
bool isValidCell(int row, int col);
bool isNotWall(int row, int col);
bool isDestination(int row, int col, Pair dest);
double calculateEuclideanDistance(int row, int col, Pair dest);
void aStarValidation(Pair src, Pair dest);
void loggingMessage(string msg) {
qDebug() << msg;
}
};
#endif // PATH_FINDER_H