New State machine tutorial

Very grateful for this Jacgues.