-
Notifications
You must be signed in to change notification settings - Fork 0
/
Helper.h
49 lines (37 loc) · 1.18 KB
/
Helper.h
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
#ifndef HELPER_H
#define HELPER_H
// Size of the Grid
#define N 4
#define BlockSize 32;
/*
* Structure of the node
* UID: Denotes unique id of the Node, will be used to
* check whether a node is visited or not.
* DT: Denotes Distance from the root node.
* HD: Denotes Heeuristic Distance of Current node from Resultant Node
* Data: Store Arrangement of the tiles in the data.
* Link: Stores Next possible states.
*/
struct Node {
char UID[N*N*2];
// string UID = "";
int DT;
int HD;
int Data[N][N];
Node * Link;
// bool operator<(const Node &o) {
// int finalState[N][N] = FINAL_STATE;
// int tSum = UpdateHD(this, finalState) + DT;
// int oSum = UpdateHD(o, finalState) + o.DT;
// return tSum < oSum;
// }
};
void toString(Node * node);
void Fill(Node * node, int dt, int hd, int data[N][N], Node * link);
void DeepcopyData(Node * node, int copy[N][N]);
void UpdateHD(Node& node, int FinalState[N][N]);
void FindZeros(int data[N][N], int * x, int * y);
void temp_display(int data[N][N]);
void GetNeighbours(Node * currentNode);
int checkSolution(Node * node, int FinalState[N][N]);
#endif