gap_as_state function

Treat gaps as a state