Skip to content

Instantly share code, notes, and snippets.

@ndunn219
Created October 5, 2019 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ndunn219/2332d944b060e5c4b896714812b1bb13 to your computer and use it in GitHub Desktop.
Save ndunn219/2332d944b060e5c4b896714812b1bb13 to your computer and use it in GitHub Desktop.
How to pick a combo lock.
# based on https://youtu.be/w4wkCcsWs4c
def guess_numbers(num1, num2):
nums = [num1, num1+10, num1+20, num1+30,
num2, num2+10, num2+20, num2+30]
return nums
def main():
print('''The first step is to find the "Sticky number"
by applying pressure to the shackle and turning clockwise
until you hear/feel a click on one number.
That is the sticky number:''')
sticky_num = int(input('Sticky number: '))
num1 = sticky_num + 5
r = num1 % 4
print('''Next you find two "guess numbers" between 0 and 11,
but pulling tight on the shackle on each number starting
with 0 and finding the first two that stick on the number.''')
guess_number1 = int(input('Guess number 1: '))
guess_number2 = int(input('Guess number 2: '))
guess_nums = guess_numbers(guess_number1, guess_number2)
# print('Guess numbers:', guess_nums)
#
number3_possibilities = []
for num in guess_nums:
if num % 4 == r:
number3_possibilities.append(num)
if len(number3_possibilities) != 2:
print('This is not a possibility. ' +
'You should start over and try again.')
exit()
print('''The guess numbers should reveal two
possible values for the third number. In turn,
position the dial at each guess number, apply
pressure to the shackle, and try to turn the
dial. The number that is less stuck is the third number.''')
print('Number 3 possibilities:', number3_possibilities)
num3 = int(input('Number 3: '))
number2_possibilities_temp = [
r+2, r+10, r+18, r+26, r+34,
r+6, r+14, r+22, r+30, r+38
]
number2_possibilities = []
for num in number2_possibilities_temp:
if abs(num-num3) <= 2:
continue
elif num >= 40:
number2_possibilities.append(num-40)
else:
number2_possibilities.append(num)
number2_possibilities.sort()
print('Number 2 possibilities:', number2_possibilities)
print('POSSIBLE COMBINATIONS')
for num in number2_possibilities:
print('({},{},{})'.format(num1, num, num3))
print('Try each of the above. Good luck!')
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment