Automaton simulator in C++