26 lines
596 B
C#
26 lines
596 B
C#
namespace AdventOfCode.Core.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);
|
|
}
|
|
}
|
|
}
|