Implement logic for the flow of the game.