State machine
State machine is a model of a system that describes the states of the system and the transitions between those states. Finite state machine (FSM) is a state machine with a finite number of states.

State Machine
State - a condition or situation in the life of an object during which it satisfies some condition, performs some activity, or waits for some event (e.g. locked, unlocked)
Transition represents the change in the system’s state in response to an event or condition (e.g. insert coin, push door)
Event (input) - a trigger that causes a transition from one state to another (e.g. insert coin, push door)
Action - an activity that is performed when a transition occurs (e.g. unlock, lock)