Example of state transition programming