After reviewing the Rock, Paper, Scissors game code, I realized that there was a bug with the computer guessing mechanism. In this guide we’re going to walk through how to implement caching in order to correct the issue.
Summary
Refactor the Rock, Paper, Scissors class by implementing caching for the computer guessing method.
Exercise File
Exercise Description
There’s currently a subtle bug with the Rock, Paper, Scissors game we built a few days ago. Work through the implementation code provided in order to see how caching can correct the issue.
Real World Usage
After reviewing the Rock, Paper, Scissors game I realized that there was an issue with the computer guessing component of the class. This is a great example of how subtle bugs can make their way in programs and, more importantly, how to fix them. Additionally, in order to correctly fix this bug you’ll need to integrate caching, which is a critical feature in a large number of applications and algorithms.
Solution
Can be found on the solutions branch on github.