blob: c0eeee07f2a7eb11733c61eeb2274904855257de (
plain)
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
|
#ifndef ASTAR_HPP
#define ASTAR_HPP
#include <ostream>
// defines the number of nodes one can go to
// we don't need this as we will have the queues
//#define NEIGHBOUR_NUM 4
// TODO add constructors and functions to calculate heuristics etc..
class AStar {
public:
private:
};
class Node {
public:
// TODO These constructors have to change
Node();
// overloading operators for ease of use.
friend bool operator<(const Node& n1, const Node& n2);
friend bool operator==(const Node& n1, const Node& n2);
friend bool operator>(const Node& n1, const Node& n2);
friend bool operator<=(const Node& n1, const Node& n2);
friend bool operator>=(const Node& n1, const Node& n2);
friend bool operator!=(const Node& n1, const Node& n2);
friend std::ostream& operator<<(std::ostream& out, const Node& n);
private:
// pointer to previous node so that I can backtrack without using recursion.
Node *previous_node;
// pointers to the next nodes of which there are 4 in a grid.
// We do not need this as we are implementing a priority queue;
//Node *next_nodes[NEIGHBOUR_NUM];
// score that is used to compare to other nodes to see if the other path is
// more efficient.
int f_score;
// path length to get to that node.
int g_score;
// heulistic length to destination.
int h_score;
// see if node has been visited.
// We don't need this as we will have an open and a closed set
//bool visited;
// updates the f_score accordingly.
void update_f_score();
};
#endif
|