-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphNode.cpp
More file actions
85 lines (58 loc) · 1.63 KB
/
GraphNode.cpp
File metadata and controls
85 lines (58 loc) · 1.63 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//
// GraphNode.cpp
// 8-Puzzle
//
// Created by Hamad Almarri on 11/2/2013.
//
#ifndef ____Puzzle__GraphNode__cpp
#define ____Puzzle__GraphNode__cpp
#include "GraphNode.h"
template <typename T>
GraphNode<T>::GraphNode() {
// allocate memory for edges vector
this->Edges = new vector< GraphNode<T>* >;
// make the token position = 7 it's out of boundry
// means no move yet
this->tokenPosition = 7;
// initialize depth, heuristic, and way to solution
this->depth = 0;
// set min max value to be not assigned value
this->minMaxValue = -32768;
// this->wayToSolution = false;
}
template <typename T>
GraphNode<T>::~GraphNode() {
// delete edges data
delete this->Edges;
}
//template <typename T>
//GraphNode<T>* GraphNode<T>::GetWayToSolutionChild() {
//
// // get the way to solution child
// for (typename vector< GraphNode<T>* >::iterator it = Edges->begin(); it != Edges->end(); it++) {
// if ((*it)->wayToSolution)
// return *it;
// }
// return NULL;
//}
//template <typename T>
//void GraphNode<T>::operator=(const GraphNode<T> &graphNodeB) {
// this->GraphNodeData = graphNodeB.GraphNodeData;
// this->depth = graphNodeB.depth;
// this->heuristic = graphNodeB.heuristic;
// this->wayToSolution = graphNodeB.wayToSolution;
//}
//
//
//template <typename T>
//bool GraphNode<T>::operator<(const GraphNode<T> &graphNodeB) {
// return (this->depth + this->heuristic) < (graphNodeB.depth + graphNodeB.heuristic);
//}
//
//
//
//template <typename T>
//bool GraphNode<T>::operator>(const GraphNode<T> &graphNodeB) {
// return (this->depth + this->heuristic) > (graphNodeB.depth + graphNodeB.heuristic);
//}
#endif