Class AStarPathFinder
- Namespace
- LibGameAI.PathFinding
- Assembly
- PathFinding.dll
A path finder implemented with the A* algorithm.
public class AStarPathFinder : IPathFinder
- Inheritance
-
AStarPathFinder
- Implements
- Inherited Members
Remarks
Optimizations to be done (some are code-related with others): TODO Use a heap/priority queue (priority heap) data structure for the open and closed nodes. TODO Either make NodeRecord structs (and update surrounding code appropriately) or use an object pool of NodeRecords. TODO Avoid always getting node record from the dictionary, just pull it once onto a local variable and use that. TODO Reuse the heuristic value from previously existing node records.
Constructors
AStarPathFinder(Func<int, float>, bool)
Create a new A* path finder.
public AStarPathFinder(Func<int, float> heuristics, bool earlyExit = false)
Parameters
heuristics
Func<int, float>Heuristic function to use.
earlyExit
boolStop as soon as goal is found in open list with the possibility of getting a costlier path?
Properties
ClosedNodes
public IEnumerable<int> ClosedNodes { get; }
Property Value
OpenNodes
public IEnumerable<int> OpenNodes { get; }
Property Value
Methods
FindPath(IGraph, int, int)
Find a path between start and goal nodes.
public IEnumerable<IConnection> FindPath(IGraph graph, int start, int goal)
Parameters
Returns
- IEnumerable<IConnection>
An enumerable containing the connections that constitute a path from start to goal.