Created
August 20, 2012 22:50
-
-
Save pxpc2/3408822 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Node { | |
| public Node parent; | |
| int x, y, flag; | |
| int cost; | |
| public Node(int x, int y, int flag) { | |
| this.x = x; | |
| this.y = y; | |
| this.flag = flag; | |
| } | |
| public Node[] getNeighbours() { | |
| return new Node[]{ | |
| nodes[x - 1][y], | |
| nodes[x + 1][y], | |
| nodes[x][y - 1], | |
| nodes[x][y + 1] | |
| }; | |
| } | |
| @Override | |
| public boolean equals(final Object o) { | |
| if (o instanceof Node) { | |
| final Node n = (Node) o; | |
| return this.x == n.x && this.y == n.y | |
| && this.cost == n.cost; | |
| } | |
| return false; | |
| } | |
| public Tile toTile(int bX, int bY, int plane) { | |
| return new Tile(x + bX, y + bY, plane); | |
| } | |
| @Override | |
| public String toString() { | |
| return ("(" + x + ", " + y + ")"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment