Wrap Up the Game in Style
Wrap Up the Game in Style. One problem with the current implementation of
game_over() is that it doesn’t update the table of guesses with the final guess. This happens because you moved
You can fix this by calling
show_guesses() from within
game_over(). In order to call
show_guesses(), though, you’ll need information about the previous guesses, so you change the signature of
game_over() to include them.
You need to make the corresponding change in
main(). You want to call
game_over() regardless of whether your user guessed the word correctly or not. This means that you don’t need the
else clause any longer, so it’s removed.
As you can see, the game now shows the final guess correctly, but the users get no feedback about whether they were able to guess the secret word correctly. To fix this, you’ll need to change
game_over() once more.
02:51 If you need to, compare your code with the version that’s included in the course materials. The game now works quite well, as long as the user plays as you would expect. In the next part of the course, you’ll add some feedback mechanisms that can guide your users if they do something wrong.
Become a Member to join the conversation.