Skip to content

Instantly share code, notes, and snippets.

@pxpc2
Created August 20, 2012 22:43
Show Gist options
  • Select an option

  • Save pxpc2/3408749 to your computer and use it in GitHub Desktop.

Select an option

Save pxpc2/3408749 to your computer and use it in GitHub Desktop.
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