java.lang.Comparable<Node>public class Node extends java.awt.Point implements java.lang.Comparable<Node>
| Modifier and Type | Field | Description |
|---|---|---|
int |
dir |
|
edu.ucsb.cs56.projects.games.pacman.Node.MutableInt |
distance |
|
int |
fCost |
|
int |
gCost |
|
int |
hCost |
|
Node |
parent |
|
static int |
tx |
|
static int |
ty |
| Constructor | Description |
|---|---|
Node(int x,
int y,
int gCost) |
Constructor for node
|
| Modifier and Type | Method | Description |
|---|---|---|
int |
compareTo(Node n) |
Compares two nodes and determines which is better
Used for sorting in priority queue
|
Node |
getChild(int dx,
int dy) |
Creates a child node which represents movement from parent node
|
void |
init() |
Initializes distance for a path.
|
void |
setDir(int dx,
int dy) |
Sets the direction of movement into node
Prevents abrupt movements (left to right and up to down)
|
finalize, getClass, notify, notifyAll, wait, wait, waitpublic static int tx
public static int ty
public int gCost
public int hCost
public int fCost
public int dir
public Node parent
public edu.ucsb.cs56.projects.games.pacman.Node.MutableInt distance
public Node(int x,
int y,
int gCost)
x - x grid coordinate of initial nodey - y grid coordinate of initial nodegCost - path cost to reach this nodepublic void init()
public Node getChild(int dx, int dy)
dx - change in xdy - change in ypublic void setDir(int dx,
int dy)
dx - change in xdy - change in y