diff --git a/AdventOfCode2025/Laboratories.cs b/AdventOfCode2025/Laboratories.cs index c084d98..fee563a 100644 --- a/AdventOfCode2025/Laboratories.cs +++ b/AdventOfCode2025/Laboratories.cs @@ -1,9 +1,32 @@ -namespace AdventOfCode2025; +using AdventOfCode2025.Utils; + +namespace AdventOfCode2025; public class Laboratories : IAdventSolution { public AdventSolution Solve(string input) { - throw new NotImplementedException(); + var lines = input.SplitLines(); + var start = lines[0].IndexOf('S'); + var splitters = new HashSet(); + var origin = new Coordinate(start, 0); + Traverse(lines, origin, splitters); + return new AdventSolution(splitters.Count.ToString(), null); + } + + private void Traverse(string[] map, Coordinate start, HashSet splitters) + { + if (start.X < 0 || start.X >= map[0].Length) + return; + + for (var y = start.Y; y < map.Length; y++) + { + if (map[y][start.X] != '^') continue; + if (!splitters.Add(new Coordinate(start.X, y))) return; + + Traverse(map, new Coordinate(start.X + 1, y), splitters); + Traverse(map, new Coordinate(start.X - 1, y), splitters); + return; + } } } \ No newline at end of file diff --git a/AdventOfCode2025/Program.cs b/AdventOfCode2025/Program.cs index cac40e3..b4e2e55 100644 --- a/AdventOfCode2025/Program.cs +++ b/AdventOfCode2025/Program.cs @@ -20,5 +20,5 @@ AdventSolver.Solve(dayFiveInput, 5, "Cafeteria"); var daySixInput = await File.ReadAllTextAsync("./Input/DaySix.txt"); AdventSolver.Solve(daySixInput, 6, "Trash Compactor"); -var daySevenInput = await File.ReadAllTextAsync("./Input/Test.txt"); +var daySevenInput = await File.ReadAllTextAsync("./Input/DaySeven.txt"); AdventSolver.Solve(daySevenInput, 7, "Laboratories"); \ No newline at end of file