AdventOfCode/AdventOfCode.Core/Shared/A-Star/AStarNode.cs

33 lines
801 B
C#

using AdventOfCode.Core.Shared.Grid;
namespace AdventOfCode.Core.Shared.A_Star
{
public class AStarNode : Point
{
/// <summary>
/// Distance from start node
/// </summary>
public long GCost { get; set; } = 0;
/// <summary>
/// Estaimated distance to end node
/// </summary>
public long HCost { get; set; }
/// <summary>
/// Total cost (G + F)
/// </summary>
public long FCost => GCost + HCost;
public AStarNode? ParentNode { get; set; }
public AStarNode() { }
public AStarNode(Point position) : base(position) { }
public AStarNode(int x, int y, char value) : base(x, y, value) { }
public virtual bool CanMoveTo(AStarNode target) => true;
}
}