Finite State Machines – What are they?
A finite state machine is a conceptual model that can used to describe how many things work. Think about a light bulb for instance. The circuit consists of a switch, that can be ON or OFF, a few wires and the bulb itself. At any moment in time the bulb is in some state – it is either turned on (emits light) or turned off (no visible effect). For a more focused discussion, let’s assume that we have two buttons – one for “turn on” and one for “turn off”. How would you describe the light bulb circuit? You’d probably put it like this: When it’s dark and I press ON, the bulb starts emitting light. Then if I press ON again, nothing changes. If I press OFF the bulb is turned off. Then if I press OFF again, nothing changes. This description is very simple and intuitive, but in fact it describes a state machine! Think of it the following way: we have a machine (the bulb) with two states, ON and OFF. We have two inputs, an ON switch and an OFF switch. If we are in state ON, pressing ON changes n