|
Britbot
|
after the A* algorithm has finished, is simply finds the best neighbor of the beginning node and returns the direction to it
Definition at line 324 of file Navigator.cs. {
Node bestNextNode = null;
//go over the neighbors of the begining
foreach (Node neighbor in beginning.GetNeighbors())
{
//if bestNode is null update and skip to next iteration
if (bestNextNode == null)
{
bestNextNode = neighbor;
continue;
}
//if this neighbors score is better then update
if (neighbor.F() < bestNextNode.F())
{
bestNextNode = neighbor;
}
}
//check if best node is null, if so then i am an idiot and YOU NEED TO INFORM ME OF THAT IMMIDIATELY
if (bestNextNode == null)
{
Logger.Write("--------------------------------------------------------------------------");
Logger.Write("--------------------------------------------------------------------------");
Logger.Write("--------------------------------------------------------------------------");
Logger.Write(" Matan K is stupid as shit, please go and tell him that");
Logger.Write("--------------------------------------------------------------------------");
Logger.Write("--------------------------------------------------------------------------");
Logger.Write("--------------------------------------------------------------------------");
return Direction.NOTHING;
//throw new Exception("Matan K is stupid as shit, please go and tell him that");
}
return Bot.Game.GetDirections(beginning.Loc, bestNextNode.Loc)[0];
}
|
1.7.6.1