Finite State Machine of a Dog in Erlang.