19.3.2 checkWin & gameIsLost

In checkWin you should check if the current level is greater than the constant NUM_LEVELS. If so, then ’won’ should be assigned true. At this point, you also switch over to the ‘score’ application state by writing ScoreState.set(1) and play a festive sound with the Sound Manager.

The method gameIsLost is similar, but the check is not necessary. You have lost when a block does not fit in the playing field. The code to check that out does not belong in this class. We will write that someplace else, and at that point this method will be called. In this method, you ensure that ‘won’ equals to false and you also switch to ScoreState. And this time you start a less festive sound.