Sample implementation of Automaton