blob: 321431c566a45908d0901e70d076354b1f8b8816 (
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
|
#ifndef ASTAR_HPP
#define ASTAR_HPP
#include "priority_queue.hpp"
#include "node.hpp"
#include <ostream>
#include <vector>
// defines the number of nodes one can go to
// we don't need this as we will have the queues
#define NEIGHBOUR_NUM 8
// TODO add constructors and functions to calculate heuristics etc..
class AStar {
public:
AStar();
AStar(int *curr_graph, const unsigned int& width, const unsigned int& height);
bool start_algorithm(int *curr_graph, const unsigned int& width, const unsigned int& height);
void recreate_path(Node n);
private:
PriorityQueue<Node> open_set;
std::vector<Node> closed_set;
int *graph;
int graph_width;
int graph_height;
int path_length;
int count;
Node start_node, end_node;
bool start_algorithm();
Node get_neighbour(Node& n_in, const int& neighbour_num);
void calc_heuristic(Node& n);
void calc_f(Node& n);
bool check_item_vec(const Node& n);
int get_index_vec(const Node& n);
void remove_from_vec(const Node& n);
Node find_node(const unsigned int& x, const unsigned int& y);
};
#endif // ASTAR_HPP
|