AdventOfCode/AdventOfCode.Core/Shared/Grid/PointHelpers.cs
2023-12-18 08:24:47 +01:00

18 lines
953 B
C#

namespace AdventOfCode.Core.Shared.Grid
{
public static class PointHelpers
{
public static Point MoveUp(this Point point) =>new (point.X, point.Y - 1, point.Value);
public static Point MoveDown(this Point point) => new(point.X, point.Y + 1, point.Value);
public static Point MoveLeft(this Point point) => new(point.X - 1, point.Y, point.Value);
public static Point MoveRight(this Point point) => new(point.X + 1, point.Y, point.Value);
public static Point MoveUp(this Point point, long toMove) => new(point.X, point.Y - toMove, point.Value);
public static Point MoveDown(this Point point, long toMove) => new(point.X, point.Y + toMove, point.Value);
public static Point MoveLeft(this Point point, long toMove) => new(point.X - toMove, point.Y, point.Value);
public static Point MoveRight(this Point point, long toMove) => new(point.X + toMove, point.Y, point.Value);
}
}