Playing the game
In this section, we will build the logic to play the game. The gameplay consists of making a number of guesses at the selected word, reviewing the score for that guess, and having another guess. The game ends either when the word has been guessed correctly or when the maximum number of allowed attempts has been made.
We’ll begin by assuming that we are at the start of a typical game, about to make our first guess. We will also assume that this guess is not completely correct. This allows us to defer decisions about end-of-the-game behavior, which is a good thing, as we have enough to decide already.
Designing the scoring interface
The first design decision we must take is what we need to return following a guess at the word. We need to return the following information to the user:
- The score for the current guess
- Whether or not the game is still in play or has ended
- Possibly the previous history of scoring for each guess
- Possibly...