The FSM package provides a simple class that implements a Finite State Machine.