-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewHelper.h
50 lines (38 loc) · 1.3 KB
/
newHelper.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
50
#ifndef HELPER_H
#define HELPER_H
// Size of the Grid
#define N 3
#define CUDA_FUNC __host__ __device__
/*
* 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.
* parentID: Stores the id of the parent that created this node 1->TOP, 2->Right, 3->Bottom, 4->Left
* Link: Stores Next possible states.
*/
struct Node {
char UID[2*N*N+1];
int DT;
int HD;
int Data[N][N];
int parentID;
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;
// }
};
CUDA_FUNC void toString(Node * node);
CUDA_FUNC void Fill(Node * node, int dt, int hd, int data[N][N], Node * link);
CUDA_FUNC void DeepcopyData(Node * node, int copy[N][N]);
CUDA_FUNC void UpdateHD(Node& node);
CUDA_FUNC void FindZeros(int data[N][N], int * x, int * y);
CUDA_FUNC void temp_display(int data[N][N]);
CUDA_FUNC int GetNeighbours(Node * currentNode);
CUDA_FUNC int checkSolution(Node * node, int FinalState[N][N]);
#endif