-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpath.h
More file actions
47 lines (36 loc) · 692 Bytes
/
path.h
File metadata and controls
47 lines (36 loc) · 692 Bytes
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
//
// Created by tehp on 2021-04-22.
//
#ifndef TOWER_PATH_H
#define TOWER_PATH_H
#include <vector>
#include <iostream>
struct Node
{
int y;
int x;
// parent
int p_x;
int p_y;
// heuristics
int f;
float g;
int h;
};
class Path {
public:
Path(int sx, int sy, int ex, int ey, std::vector<std::vector<float>> m);
~Path();
int g(Node n);
int h(Node n);
int f(Node n);
void print_node(Node n);
void a_star();
std::vector<std::pair<int,int>> getPath();
private:
int start_x, start_y;
int end_x, end_y;
std::vector<std::vector<float>> map;
std::vector<std::pair<int, int>> path;
};
#endif //TOWER_PATH_H