Function gameReducer

Computes the next game state from a given action.