Skip to content

Instantly share code, notes, and snippets.

@krisives
Created March 2, 2015 02:48
Show Gist options
  • Save krisives/0150031bb5c46b31d9ed to your computer and use it in GitHub Desktop.
Save krisives/0150031bb5c46b31d9ed to your computer and use it in GitHub Desktop.
private Pos NextPathNode(LinkedList<Pos> open, Pos goal)
{
LinkedListNode<Pos> node = open.First;
LinkedListNode<Pos> best = node;
int bestScore = EstimatePath(node.Value, goal);
while (node.Next != null)
{
node = node.Next;
int score = EstimatePath(node.Value, goal);
if (score < bestScore)
{
bestScore = score;
best = node;
}
}
return best.Value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment