https://it.wikipedia.org/wiki/Automa_a_stati_finiti
Collection of useful exercises for understanding problems on deterministic sequential systems.



To simulate finite state automata, you could use
Finite State Automaton Exercise
Study the automaton that detects the presence of three consecutive ones.
I = {0, 1}
U = {0, 1}
S = {A, B, C, D}

Start from A, enter 0 and stay in A, enter 1 and go to B, in C enter 0 and restart from A, if instead enter 1 the system is in equilibrium.
Analogy between automaton and algorithm.
int IN = 0, OUT = 0;
while (1)
IN = random (1);
if (IN == 1) OUT++; else OUT = 0;
if (OUT == 3) { printf ("1, 1, 1 ");OUT = 0;}