-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNode.pde
45 lines (44 loc) · 935 Bytes
/
Node.pde
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
class Node {
//state of the node
State state;
//id of the node in the array
private int ID;
//id of the parent of the node in the array
private int parentID;
//is the node expanded
private boolean visited;
// depth of the node
private int depth;
//constructor
Node(State state, int id, int parentID, boolean visited, int depth) {
this.state = state;
this.ID = id;
this.parentID = parentID;
this.visited = visited;
this.depth = depth;
}
//getters
public boolean getVisited() {
return this.visited;
}
public State getState() {
return this.state;
}
public int getID() {
return this.ID;
}
public int getParentID() {
return this.parentID;
}
public int getDepth() {
return this.depth;
}
public int getCost() {
//f(n)=h(n)
return this.state.getH();
}
//setters
public void setVisited(boolean visited) {
this.visited = visited;
}
}