Holiday Hack Challenge 2023 Report Cody Travis <cwtravis@gmail.com>
Top

Faster Lock Combination

Difficulty:

Description:

Over on Steampunk Island, Bow Ninecandle is having trouble opening a padlock. Do some research and see if you can help open it!


Solution

Solution

For this particular lock, there is a method to finding the correct combination. The algorithm is a bit confusing at first. I do recommend watching the video recommended by the hint:

[198] Close Up On How To Decode A Dial Combination Lock In 8 Attempts Or Less

I definitely found the youtube video a bit confusing as it wasn't explained all that clearly. I found a PDF that is way better at explaining it for me. I could not find who made this PDF to give them thanks but here it is:

How_To_Decode_Dial_Combo_Locks.pdf

Once you have the sticky number and the guess numbers you can narrow down the guesses to 8 guesses maximum.

I will not repeat the algorithm here as its clearly laid out in the PDF, but if you follow the algorithm it will allow you to guess the combo very quickly.


Script It!

Script It!

For the very lazy, I created a python script to do the math for you. You just have to enter the sticky number and the 2 guess numbers and it will spit out the possible combos for you.

  </>
Python
#Find the absolute shortest distance between 2 numbers with a modulus
def abs_distance(n1, n2, mod):
    d = abs((n1+mod)-(n2+mod))%mod
    return min(d, mod-d)

sticky_number = int(input("Enter the sticky number:"))
guess_number1 = int(input("Enter the first guess number:"))
guess_number2 = int(input("Enter the second guess number:"))

#first number is sticky number + 5
first_number = sticky_number + 5
sticky_remainder = first_number % 4
third_possibilities = [guess_number1, guess_number2]

for i in range(10,40,10):
    n = (guess_number1+i)%40
    third_possibilities.append(n)
      
for i in range(10,40,10):
    n = (guess_number2+i)%40
    third_possibilities.append(n)

third_numbers = []
for possibility in third_possibilities:
    if possibility % 4 == sticky_remainder:
        third_numbers.append(possibility)

input_str = "Which 3rd possibility [" + ','.join(str(x) for x in third_numbers) + "] is correct (looser)? " 
third_number = int(input(input_str))
sticky_remainder = sticky_remainder + 2
second_possibilities = [sticky_remainder]

for i in range(8,40,8):
    n = (sticky_remainder+i)%40
    second_possibilities.append(n)
    
sticky_remainder = sticky_remainder + 4
second_possibilities.append(sticky_remainder)

for i in range(8,40,8):
    n = (sticky_remainder+i)%40
    second_possibilities.append(n)

print(second_possibilities)
second_numbers = []

for possibility in second_possibilities:
    if abs_distance(third_number,possibility, 40) > 2:
        second_numbers.append(possibility)

print("Possible Combinations:")
for n in second_numbers:
    print(f"({first_number},{n},{third_number})")
Python Script
  </>
Python
Enter the sticky number:17
Enter the first guess number:8
Enter the second guess number:1
Which 3rd possibility [18,38] is correct (looser)? 18

Possible Combinations:
(22,4,18)
(22,12,18)
(22,28,18)
(22,36,18)
(22,8,18)
(22,24,18)
(22,32,18)
(22,0,18)
Python Script Output

The script output the 8 possibilities. Turns out it was the 5th guess (22,8,18).


Cheating

Cheating

If you look in the javascript console, there is a variable called "lock_numbers". The correct combination is in there.

Combination in JS Console

In the above example, enter the numbers 34, 28, 14, then pull the lock down to unlock it.