From 32c1249928ee0cfefed92994c9cfe8c70bd9902c Mon Sep 17 00:00:00 2001 From: Boxfriend Date: Mon, 1 Dec 2025 14:12:04 -0500 Subject: [PATCH] brute forced part two --- AdventOfCode2025/SecretEntrance.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/AdventOfCode2025/SecretEntrance.cs b/AdventOfCode2025/SecretEntrance.cs index 316adcf..fceaf6c 100644 --- a/AdventOfCode2025/SecretEntrance.cs +++ b/AdventOfCode2025/SecretEntrance.cs @@ -8,15 +8,25 @@ public class SecretEntrance : IAdventSolution var current = 50; var password = 0; + var password2 = 0; foreach (var line in lines) { var direction = line[0] == 'L' ? -1 : 1; - var distance = int.Parse(line.Substring(1)) * direction; - current += distance; + var distance = int.Parse(line.Substring(1)); + var change = distance * direction; + for (var temp = current; distance > 0; distance--) + { + temp += direction; + temp %= 100; + if(temp == 0) password2++; + } + + + current += change; current %= 100; if(current == 0) password++; } - return new AdventSolution(password.ToString(), null); + return new AdventSolution(password.ToString(), password2.ToString()); } } \ No newline at end of file