-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.h
More file actions
35 lines (30 loc) · 820 Bytes
/
Copy pathnode.h
File metadata and controls
35 lines (30 loc) · 820 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
class Node {
private:
int cost; // This is g(n). in this case it is also the depth
int distanceToGoal; // This is h(n). an estimation of how good the current state is
short state[9];
unsigned long key;
Node* parent;
void updateKey();
public:
Node();
Node(const Node& n);
~Node();
void set_cost(int c);
int get_cost();
void set_distanceToGoal(int d);
int get_distanceToGoal();
void set_state(const short* s);
short* get_state();
void set_parent(Node* p);
Node* get_parent();
unsigned long get_key();
bool operator<(const Node& rhs) const;
bool operator>(const Node& rhs) const;
bool operator==(const Node& rhs) const;
bool move_blank_up(Node& n);
bool move_blank_right(Node& n);
bool move_blank_down(Node& n);
bool move_blank_left(Node& n);
void print();
};