GridPoint.cs 422 B

123456789101112131415161718192021222324
  1. namespace Day10;
  2. public record GridPoint(int X, int Y)
  3. {
  4. public GridPoint North()
  5. {
  6. return new GridPoint(X, Y - 1);
  7. }
  8. public GridPoint East()
  9. {
  10. return new GridPoint(X + 1, Y);
  11. }
  12. public GridPoint South()
  13. {
  14. return new GridPoint(X, Y + 1);
  15. }
  16. public GridPoint West()
  17. {
  18. return new GridPoint(X - 1, Y);
  19. }
  20. }