-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclass_asNode.h
More file actions
54 lines (40 loc) · 1.29 KB
/
class_asNode.h
File metadata and controls
54 lines (40 loc) · 1.29 KB
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
54
#ifndef asNode_h
#define asNode_h
#include "class_node.h"
#include <vector>
#include <array>
class asNode : public pfNode{
private:
double g; //local value
double h; //heuristic
double f; //global value
asNode *Parent=NULL;
bool Visited=false;
std::vector<asNode*> Neighbors;
std::array<int,2> Position;
//-------------------------------------------------------------------------------------------------
public:
// Constructor
//asNode(std::array<int,2> _position, int i) : pfNode(i), Position(_position) {};
asNode(std::array<int,2> _position, pfNode *_node) : pfNode(_node->GetType() ), Position(_position) {};
// asNode(int i) : pfNode(i) {};
// asNode(pfNode &_node) : pfNode(_node.GetType()) {};
asNode()=default;
// Setter:
void Setg(double _g);
void Seth(double _h);
void Setf();
void SetParent(asNode &_parent);
void SetNeighbor(asNode &_neighbor);
void SetVisited();
// Getter:
double* Getg() {return &g;}
double* Geth() {return &h;}
double* Getf() {return &f;}
asNode* GetParent() const {return Parent;}
bool* isVisited() {return &Visited;}
std::vector<asNode*>* GetNeighbors() {return &(Neighbors);}
std::array<int,2> GetPosition() {return Position;}
std::array<int,2>* GetPositionRef() {return &Position;}
};
#endif