AdventOfCode/AdventOfCode.Core/Shared/Node.cs
Rob 3846b42b7e Massive code base change
partial completion of day 3
2023-12-03 19:09:26 +01:00

33 lines
723 B
C#

namespace AdventOfCode.Core.Shared
{
public class Node
{
public int X { get; set; }
public int Y { get; set; }
public char Char { get; set; }
public short Integer => (short)Char;
public Node() { }
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);
}
public override string ToString()
{
return $"[{Y},{X}] {Char}";
}
}
}