-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patha_star.h
33 lines (26 loc) · 897 Bytes
/
a_star.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
#ifndef A_STAR_H
#define A_STAR_H
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
const int COL = 500;
typedef pair<int, int> Pair;
// Creating a shortcut for pair<int, pair<int, int>> type
typedef pair<double, pair<int, int> > pPair;
// A structure to hold the neccesary parameters
struct cell {
// Row and Column index of its parent
// Note that 0 <= i <= ROW-1 & 0 <= j <= COL-1
int parent_i, parent_j;
// f = g + h
double f, g, h;
};
bool isValid(int row, int col);
bool isUnBlocked(int grid[][COL], int row, int col);
bool isDestination(int row, int col, Pair dest);
double calculateHValue(int row, int col, Pair dest);
void tracePath(cell cellDetails[][COL], Pair dest);
void aStarSearch(int grid[][COL], Pair src, Pair dest);
void aStarSearch(int grid[][COL], Pair src, Pair dest);
list<Pair> maint(int grid[][COL], Pair src, Pair dest);
#endif