From 0b6ef73f4b3557d5abe44ecc6e79f7d5ae542f2e Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Tue, 2 Dec 2025 12:20:10 -0800 Subject: [PATCH] 2025 01 --- Python/2025/01/main.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Python/2025/01/main.py diff --git a/Python/2025/01/main.py b/Python/2025/01/main.py new file mode 100644 index 0000000..c0c58b7 --- /dev/null +++ b/Python/2025/01/main.py @@ -0,0 +1,37 @@ +input = open("input", 'r') + +rotations = [] + +for i, line in enumerate(input): + rotations.append((line[0], int(line[1:]))) + +password = 0 +password_CLICK = 0 +dial = 50 + +# print("The dial starts by pointing at", dial) +for direction, length in rotations: + clicks = length // 100 + length = length % 100 + length *= 1 if direction == "R" else -1 + + dial_new = dial + length + + if (dial_new <= 0 < dial) or \ + (dial < 100 <= dial_new): + clicks += 1 + + dial = dial_new % 100 + + password_CLICK += clicks + if dial == 0: + password += 1 + + # if clicks == 0: + # print("The dial is rotated", length, "to point at", dial) + # else: + # print("The dial is rotated", length, "to point at", dial, + # "| during this rotation, it points at 0:", clicks, "times") + +print(password) +print(password_CLICK)