From a11800d0d7691048d46457d75f2d03f5c62981e2 Mon Sep 17 00:00:00 2001 From: Brechtje van Gessel Date: Mon, 1 Dec 2025 17:06:32 +0100 Subject: [PATCH] attempt 1 --- brechtje/1/1-2.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 brechtje/1/1-2.py diff --git a/brechtje/1/1-2.py b/brechtje/1/1-2.py new file mode 100644 index 0000000..4c060ee --- /dev/null +++ b/brechtje/1/1-2.py @@ -0,0 +1,21 @@ +input = open("input.txt", "r").read().splitlines() + +pos = 50 +password = 0 + +for line in input: + if line.startswith('L'): + pos -= int(line[1:]) + elif line.startswith('R'): + pos += int(line[1:]) + + # keep subtracting or adding 100 until position is between 0 and 99 + while pos < 0 or pos > 99: + if pos < 0: + pos += 100 + password += 1 + elif pos > 99: + pos -= 100 + password += 1 + +print(password) \ No newline at end of file