snake style with state machine