Compare commits
2 Commits
86947a6e6d
...
a653f07669
| Author | SHA1 | Date | |
|---|---|---|---|
| a653f07669 | |||
| 1649440a6e |
@@ -36,6 +36,10 @@
|
|||||||
<Content Include="Input\DaySix.txt">
|
<Content Include="Input\DaySix.txt">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<None Remove="Input\DaySeven.txt" />
|
||||||
|
<Content Include="Input\DaySeven.txt">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
32
AdventOfCode2025/Laboratories.cs
Normal file
32
AdventOfCode2025/Laboratories.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using AdventOfCode2025.Utils;
|
||||||
|
|
||||||
|
namespace AdventOfCode2025;
|
||||||
|
|
||||||
|
public class Laboratories : IAdventSolution
|
||||||
|
{
|
||||||
|
public AdventSolution Solve(string input)
|
||||||
|
{
|
||||||
|
var lines = input.SplitLines();
|
||||||
|
var start = lines[0].IndexOf('S');
|
||||||
|
var splitters = new HashSet<Coordinate>();
|
||||||
|
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<Coordinate> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,4 +18,7 @@ var dayFiveInput = await File.ReadAllTextAsync("./Input/DayFive.txt");
|
|||||||
AdventSolver<Cafeteria>.Solve(dayFiveInput, 5, "Cafeteria");
|
AdventSolver<Cafeteria>.Solve(dayFiveInput, 5, "Cafeteria");
|
||||||
|
|
||||||
var daySixInput = await File.ReadAllTextAsync("./Input/DaySix.txt");
|
var daySixInput = await File.ReadAllTextAsync("./Input/DaySix.txt");
|
||||||
AdventSolver<TrashCompactor>.Solve(daySixInput, 6, "Trash Compactor");
|
AdventSolver<TrashCompactor>.Solve(daySixInput, 6, "Trash Compactor");
|
||||||
|
|
||||||
|
var daySevenInput = await File.ReadAllTextAsync("./Input/DaySeven.txt");
|
||||||
|
AdventSolver<Laboratories>.Solve(daySevenInput, 7, "Laboratories");
|
||||||
Reference in New Issue
Block a user