A state machine allows us as a developer to take a complex task and simplify it down by using the state of an instance.
For example if we take a look at this treasure chest, we can see it might have four different states.
Idle
Opening
Opened
Closing