-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.h
More file actions
40 lines (30 loc) · 901 Bytes
/
node.h
File metadata and controls
40 lines (30 loc) · 901 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
/**
* @file node.h
* @brief Node specific functions for n-puzzle problem
*
* @author Mitchell Clay
* @date 4/9/2020
**/
#ifndef node_H
#define node_H
struct Node {
// address of parent Node struct that this node was
// generated from
struct Node *parent;
// stores blank tile position
unsigned blank_position;
// count of how many elements are not in final position
int cost;
// number of moves from initial state to get here
int level;
// direction blank moved to get here
int direction;
// child nodes
struct Node* children[4];
// row-major representation of puzzle grid state
unsigned arr[];
};
int calculateCost(unsigned*, unsigned*, unsigned);
struct Node *newNode(struct Node*, unsigned*, unsigned, unsigned, unsigned, int, struct Node*, bool);
void printNodeInfo(struct Node*, unsigned);
#endif