## Definition

A **finite-state machine** (FSM) or finite-state automaton (FSA), or simply a state machine, is a mathematical model of computation used to design both computer programs and sequential logic circuits.

It is conceived as an abstract machine that can be in one of a finite number of states. The machine is in only one state at a time; the state it is in at any given time is called the current state. It can change from one state to another when initiated by a triggering event or condition; this is called a **transition**.

A particular FSM is defined by a list of its states, its initial state, and the triggering condition for each transition.

Source: Wikipedia (license)

#### External resources

Finite State MachineJoin the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!

JOIN US ON DISCORD Online Participants