GridPoint.cs 320 B

123456789101112131415
  1. namespace Day10;
  2. public record GridPoint(long X, long Y)
  3. {
  4. public GridPoint Add(GridPoint other)
  5. {
  6. return new GridPoint(X + other.X, Y + other.Y);
  7. }
  8. public long Distance(GridPoint other)
  9. {
  10. return Math.Abs(X - other.X)
  11. + Math.Abs(Y - other.Y);
  12. }
  13. }