Triangulating Game Progress Tracking by Refactoring
Explore how to apply test-driven development to track game progress by incrementing attempt counts and updating storage. Learn refactoring techniques to improve code clarity and reduce errors while maintaining test reliability.
We'll cover the following...
We'll cover the following...
At this point, nothing needs our urgent attention. We can move on to tracking progress through the game.
Triangulating progress tracking
We need to track the number of guesses that have been made so that we can end the game after a maximum number of attempts. Our design choice is to update the attemptNumber field in the Game object and then store it in GameRepository:
We add a test to drive this code out:
This test introduces a new method, ...