From 990a5900f7853c13d137205afa437a3d92d73c97 Mon Sep 17 00:00:00 2001 From: Boxfriend Date: Mon, 1 Dec 2025 13:20:37 -0500 Subject: [PATCH] day one part one --- AdventOfCode2025/Program.cs | 7 ++++++- AdventOfCode2025/SecretEntrance.cs | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 AdventOfCode2025/SecretEntrance.cs diff --git a/AdventOfCode2025/Program.cs b/AdventOfCode2025/Program.cs index 779c0be..db00078 100644 --- a/AdventOfCode2025/Program.cs +++ b/AdventOfCode2025/Program.cs @@ -1 +1,6 @@ -Console.WriteLine("Advent of Code 2025"); +using AdventOfCode2025; + +Console.WriteLine("Advent of Code 2025"); + +var dayOneInput = await File.ReadAllTextAsync("./Input/DayOne.txt"); +AdventSolver.Solve(dayOneInput, 1, "Secret Entrance"); \ No newline at end of file diff --git a/AdventOfCode2025/SecretEntrance.cs b/AdventOfCode2025/SecretEntrance.cs new file mode 100644 index 0000000..316adcf --- /dev/null +++ b/AdventOfCode2025/SecretEntrance.cs @@ -0,0 +1,22 @@ +namespace AdventOfCode2025; + +public class SecretEntrance : IAdventSolution +{ + public AdventSolution Solve(string input) + { + var lines = input.Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); + + var current = 50; + var password = 0; + foreach (var line in lines) + { + var direction = line[0] == 'L' ? -1 : 1; + var distance = int.Parse(line.Substring(1)) * direction; + current += distance; + current %= 100; + if(current == 0) password++; + } + + return new AdventSolution(password.ToString(), null); + } +} \ No newline at end of file