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:

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?

Assignment

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.

Example

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.