···1818 'D' => c with { y = c.y == 2 ? c.y : c.y + 1 },
1919 'L' => c with { x = c.x == 0 ? c.x : c.x - 1 },
2020 'R' => c with { x = c.x == 2 ? c.x : c.x + 1 },
2121- _ => throw new ArgumentException("invalid direction", nameof(instruction))
2121+ _ => throw new ArgumentException("invalid direction", nameof(instruction)),
2222 });
23232424 answer.Add(1 + location.x + location.y * 3);
···4848 'D' => c with { y = c.y == 4 || keyPad[c.y + 1, c.x] == '\0' ? c.y : c.y + 1 },
4949 'L' => c with { x = c.x == 0 || keyPad[c.y, c.x - 1] == '\0' ? c.x : c.x - 1 },
5050 'R' => c with { x = c.x == 4 || keyPad[c.y, c.x + 1] == '\0' ? c.x : c.x + 1 },
5151- _ => throw new ArgumentException("invalid direction", nameof(instruction))
5151+ _ => throw new ArgumentException("invalid direction", nameof(instruction)),
5252 });
53535454 answer.Add(keyPad[location.y, location.x]);
+4-4
Solutions/2016/Day07.cs
···3131 private static bool SupportsSsl(string input)
3232 {
3333 foreach (var ip in BracketsRegex().Split(input))
3434- foreach (var aba in CheckAba(ip))
3535- foreach (var m in InsideBracketsRegex().Matches(input).Cast<Match>())
3636- if (m.Value.Contains($"{aba[1]}{aba[0]}{aba[1]}"))
3737- return true;
3434+ foreach (var aba in CheckAba(ip))
3535+ foreach (var m in InsideBracketsRegex().Matches(input).Cast<Match>())
3636+ if (m.Value.Contains($"{aba[1]}{aba[0]}{aba[1]}"))
3737+ return true;
38383939 return false;
4040 }
···3333 _plane4[(x, y, 0, 0)] = input[y][x];
3434 }
35353636- private static int Neighbors(IReadOnlyDictionary<(int x, int y, int z), char> plane, int x, int y, int z)
3636+ private static int Neighbors(Dictionary<(int x, int y, int z), char> plane, int x, int y, int z)
3737 {
3838 var neighbors = 0;
3939···4949 }
50505151 private static Dictionary<(int x, int y, int z), char> Iterate(
5252- IReadOnlyDictionary<(int x, int y, int z), char> prev)
5252+ Dictionary<(int x, int y, int z), char> prev)
5353 {
5454 var next = new Dictionary<(int x, int y, int z), char>();
5555···6767 return next;
6868 }
69697070- private static int Neighbors4(IReadOnlyDictionary<(int x, int y, int z, int w), char> plane, int x, int y,
7070+ private static int Neighbors4(Dictionary<(int x, int y, int z, int w), char> plane, int x, int y,
7171 int z, int w)
7272 {
7373 var neighbors = 0;
···8585 }
86868787 private static Dictionary<(int x, int y, int z, int w), char> Iterate4(
8888- IReadOnlyDictionary<(int x, int y, int z, int w), char> prev)
8888+ Dictionary<(int x, int y, int z, int w), char> prev)
8989 {
9090 var next = new Dictionary<(int x, int y, int z, int w), char>();
9191