Must the states of a finite state machine be worked off sequentially or could you understand the different shaped parts of the key as input and the position of the pins as states?
If not all the input is right: failure state = stays locked
If all the input is right: end state = lock opens

I was inspired by this (German grammar-school) resource, where on page 7 are diagrams of a combination lock as a finite state machine.

  • 1
    $\begingroup$ What are the possible states? What are the possible transitions between states? Count! $\endgroup$ Sep 28, 2014 at 16:27
  • $\begingroup$ @DaveClarke Actually I am not sure and am quite confused. Please take a look at my update. $\endgroup$
    – Lester
    Sep 28, 2014 at 17:26

1 Answer 1


Yes and no. Arguably, the lock is not a finite state machine, since the key can be inserted to any degree and, if it fits, rotated through any angle. However, we can abstract away these unimportant details, yes, the system can be modeled as a finite number of states: essentially, if you code up the ridges of the key as symbols in some alphabet, the lock is a DFA that accepts exactly one word (or perhaps more, if there's a master key).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.