Broken state machine

Ignore .DS_Store.
Tried to implement a state machine but it is totally broken.