Created
August 20, 2012 22:43
-
-
Save pxpc2/3408749 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
| private Node[] getPath(Node start, Node end) { | |
| int endTotal = end.x + end.y; | |
| if (currentValue != endTotal) { | |
| if (currentValue == 0) | |
| currentValue = start.x + start.y; | |
| Collections.addAll(open, start.getNeighbours()); | |
| Node newN = getCheapest(open); | |
| open.remove(newN); | |
| currentValue = newN.x + newN.y; | |
| closed.add(newN); | |
| return getPath(newN, end); | |
| } | |
| return closed.toArray(new Node[closed.size()]); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment