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