gumball machine converted to state machine