feat: solved day 15 part 2

This commit is contained in:
Stevan Freeborn
2024-12-16 23:51:43 -06:00
parent 3b06f96259
commit 8e64d65e7d
11 changed files with 764 additions and 205 deletions
+26
View File
@@ -0,0 +1,26 @@
namespace WarehouseWoes;
record Direction(int Xd, int Yd)
{
private const char UpCharacter = '^';
private const char RightCharacter = '>';
private const char DownCharacter = 'v';
private const char LeftCharacter = '<';
private static readonly Direction Up = new(0, -1);
private static readonly Direction Down = new(0, 1);
public static readonly Direction Left = new(-1, 0);
public static readonly Direction Right = new(1, 0);
public static Direction From(char character)
{
return character switch
{
UpCharacter => Up,
RightCharacter => Right,
DownCharacter => Down,
LeftCharacter => Left,
_ => throw new ArgumentException(@$"{nameof(character)} is not a valid: {character}"),
};
}
}