@fastfinge I actually learned about finite state machines, pushdown automata, and the like as part of my degree. A deterministic FSM is pretty simple. I personally implement them as an enum and a function which is called repeatedly with a switch/case statement on a continuously changing state variable. About the most direct form of such a thing.