namespace Day23; public record struct Vec { public static Vec Zero { get; } = new Vec(0, 0); public static Vec Up { get; } = new Vec(0, -1); public static Vec Down { get; } = new Vec(0, 1); public static Vec Left { get; } = new Vec(-1, 0); public static Vec Right { get; } = new Vec(1, 0); public long X { get; } public long Y { get; } public bool IsHorizontal => Y == 0; public bool IsVertical => X == 0; public Vec(long x, long y) { X = x; Y = y; } public Vec RotatePositive() { // clockwise return new Vec(-1 * Y, X); } public Vec RotateNegative() { // counter-clockwise return new Vec(Y, -1 * X); } public Vec Add(Vec other) { return new Vec(X + other.X, Y + other.Y); } public Vec Subtract(Vec other) { return new Vec(X - other.X, Y - other.Y); } public Vec Multiply(int f) { return new Vec(f * X, f * Y); } public long Cross(Vec other) { return X * other.Y - other.X * Y; } }