jQuery Finite State Machine
Emmanuel Podvin
a Finite and Hierarchical State Machine (FSM / HSM) to design simulators and games in JQuery