-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathState.h
More file actions
84 lines (66 loc) · 1.29 KB
/
State.h
File metadata and controls
84 lines (66 loc) · 1.29 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
//
// Created by ori on 12/01/2020.
//
#ifndef EX4_STATE_H
#define EX4_STATE_H
/*
* class the define the T value of the matrix in our problem
*/
class square {
private:
int row;
int column;
public:
square(int i, int j) {
this->row = i;
this->column = j;
}
int getRow() const {
return row;
}
int getColumn() const {
return column;
}
};
//data member of color for the search algorithms
template<typename T>
class State {
private:
T state;
double cost;
double h_cost;
State<T> *camefrom;
char color;
public:
State(T state1, double cost1, double h_cost_) {
this->state = state1;
this->cost = cost1;
this->color = 'w';
this->h_cost = h_cost_;
}
double getCost() const {
return cost;
}
double GetHCost() const {
return h_cost;
}
void setCost(double cost) {
State::cost = cost;
}
char getColor() const {
return color;
}
void setColor(char color) {
this->color = color;
}
T getState() const {
return state;
}
void setCamefrom(State<T> *camefrom) {
this->camefrom = camefrom;
}
State<T> *getCamefrom() const {
return camefrom;
}
};
#endif //EX4_STATE_H