part one complete
This commit is contained in:
@@ -1,9 +1,32 @@
|
|||||||
namespace AdventOfCode2025;
|
using AdventOfCode2025.Utils;
|
||||||
|
|
||||||
|
namespace AdventOfCode2025;
|
||||||
|
|
||||||
public class Laboratories : IAdventSolution
|
public class Laboratories : IAdventSolution
|
||||||
{
|
{
|
||||||
public AdventSolution Solve(string input)
|
public AdventSolution Solve(string input)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,5 +20,5 @@ 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/Test.txt");
|
var daySevenInput = await File.ReadAllTextAsync("./Input/DaySeven.txt");
|
||||||
AdventSolver<Laboratories>.Solve(daySevenInput, 7, "Laboratories");
|
AdventSolver<Laboratories>.Solve(daySevenInput, 7, "Laboratories");
|
||||||
Reference in New Issue
Block a user