You’re sure that’s the right password, but the door won’t open. You knock, but nobody answers. You build a snowman while you think.
As you’re rolling the snowballs for your snowman, you find another security document that must have fallen into the snow:
“Due to newer security protocols, please use password method 0x434C49434B until further notice.”
You remember from the training seminar that “method 0x434C49434B” means you’re actually supposed to count the number of times any click causes the dial to point at 0, regardless of whether it happens during a rotation or at the end of one.
Following the same rotations as in the above example, the dial points at zero a few extra times during its rotations:
50.L68 to point at 82; during this rotation, it points at 0 once.L30 to point at 52.R48 to point at 0.L5 to point at 95.R60 to point at 55; during this rotation, it points at 0 once.L55 to point at 0.L1 to point at 99.L99 to point at 0.R14 to point at 14.L82 to point at 32; during this rotation, it points at 0 once.In this example, the dial points at 0 three times at the end of a rotation, plus three more times during a rotation. So, in this example, the new password would be 6.
Be careful: if the dial were pointing at 50, a single rotation like R1000 would cause the dial to point at 0 ten times before returning back to 50!
Using password method 0x434C49434B, what is the password to open the door?
Write a bash shell script secret_entrance that takes the pathname of a document with rotations. The script must output the password derived from using method 0x434C49434B on these rotations to stdout. For example, if we take document with rotations (data.txt)
L30
R48
L5
R60
L55
L1
L99
R14
L82
the password should be 6.
In this interactive session, we assume that the text file data.txt is in the current directory.
$ secret_entrance data.txt
6
Advent of Code 2025
This assignment is based on Eric Wastl’s Advent of Code 2025.