namespace ReactorMaintenance.Simulation;

public static class GridPositionExtensions
{
    public static IEnumerable<GridPosition> Neighbors(this GridPosition position)
    {
        yield return new(position.X, position.Y - 1);
        yield return new(position.X + 1, position.Y);
        yield return new(position.X, position.Y + 1);
        yield return new(position.X - 1, position.Y);
    }

    public static int ManhattanDistance(this GridPosition position, GridPosition other)
    {
        return Math.Abs(position.X - other.X) + Math.Abs(position.Y - other.Y);
    }
}