Labyrinth
A labyrinth game assignment
Node.java
Go to the documentation of this file.
1 
13 package host.labyrinth;
14 
15 import java.util.ArrayList;
16 
20 class Node {
21 
25  Node () { }
28  this.parent = parent;
29  this.children = null;
30  this.nodeDepth = nodeDepth;
31  this.nodeMove = nodeMove;
32  this.nodeBoard = nodeBoard;
33  this.nodeEvaluation = nodeEvaluation;
34  this.path = null;
35  }
38  this.parent = null;
39  this.children = null;
40  this.nodeDepth = 0;
41  this.nodeMove = new int [4];
42  this.nodeBoard = nodeBoard;
43  this.nodeEvaluation = 0;
44  this.path = null;
45  }
51  Node getParent() { return parent; }
53  ArrayList<Node>
54  getChildren() { return children; }
56  int getNodeDepth() { return nodeDepth; }
58  int[] getNodeMove() { return nodeMove; }
62  double getNodeEvaluation (){ return nodeEvaluation; }
64  Node getPath() { return path; }
65 
67  void setParent(Node parent) { this.parent = parent; }
69  void setChildren(ArrayList<Node> children) {
70  this.children = children;
71  }
73  void setNodeDepth(int nodeDepth) {
74  this.nodeDepth = nodeDepth;
75  }
77  void setNodeMove(int[] nodeMove) {
78  this.nodeMove = nodeMove;
79  }
82  this.nodeBoard = nodeBoard;
83  }
86  this.nodeEvaluation = nodeEvaluation;
87  }
89  void setPath (Node path) {
90  this.path = path;
91  }
92 
102  boolean addChild (Node child) {
103  if (children == null)
104  children = new ArrayList<>();
105  return children.add(child);
106  }
111  private Node parent;
112  private ArrayList<Node> children;
113  private int nodeDepth;
114  private int[] nodeMove;
115  private Board nodeBoard;
116  private double nodeEvaluation;
117  private Node path;
119 }
Node getPath()
get path
Definition: Node.java:64
Node(Node parent, int nodeDepth, int [] nodeMove, Board nodeBoard, double nodeEvaluation)
The main constructor for the Node.
Definition: Node.java:27
This class is the representation of the games&#39;s board.
Definition: Board.java:25
int nodeDepth
The Node&#39;s depth.
Definition: Node.java:113
void setPath(Node path)
set path
Definition: Node.java:89
ArrayList< Node > getChildren()
get children
Definition: Node.java:54
void setNodeDepth(int nodeDepth)
set nodeDepth
Definition: Node.java:73
ArrayList< Node > children
Fwd reference to leaf Nodes.
Definition: Node.java:112
void setChildren(ArrayList< Node > children)
set children
Definition: Node.java:69
int [] getNodeMove()
get nodeMove
Definition: Node.java:58
void setNodeMove(int[] nodeMove)
set nodeMove
Definition: Node.java:77
Node parent
Back reference to parent Node.
Definition: Node.java:111
int getNodeDepth()
get nodeDepth
Definition: Node.java:56
double getNodeEvaluation()
get nodeEvluation
Definition: Node.java:62
Board nodeBoard
Reference to Board&#39;s copy of the current node.
Definition: Node.java:115
Node()
Null initialize constructor.
Definition: Node.java:25
void setNodeBoard(Board nodeBoard)
set nodeBoard
Definition: Node.java:81
Node path
The minimax evaluation path.
Definition: Node.java:117
void setParent(Node parent)
set parent
Definition: Node.java:67
int [] nodeMove
The Node&#39;s move data [tile, initTile, points, roll].
Definition: Node.java:114
void setNodeEvaluation(double nodeEvaluation)
set nodeEvaluation
Definition: Node.java:85
Node object for minimax tree.
Definition: Node.java:20
double nodeEvaluation
The Node&#39;s evaluation result.
Definition: Node.java:116
boolean addChild(Node child)
Add a child to the tree.
Definition: Node.java:102
Node getParent()
Get parent.
Definition: Node.java:51
Board getNodeBoard()
get nodeBoard
Definition: Node.java:60
Node(Board nodeBoard)
A special constructor for creating a root Node.
Definition: Node.java:37