AdventOfCode/Advent Of Code Library/Shared/Node.cs
2023-11-27 21:50:58 +01:00

26 lines
598 B
C#

namespace AdventOfCodeLibrary.Shared
{
public class Node
{
internal int X { get; set; }
internal int Y { get; set; }
internal char Char { get; }
internal short Integer => (short)Char;
public Node(int x, int y, char character)
{
X = x;
Y = y;
Char = character;
}
public Node(Node position) : this(position.X, position.Y, position.Char)
{ }
public int DistanceTo(Node other)
{
return Math.Abs(X - other.X) + Math.Abs(Y - other.Y);
}
}
}