Hint: Steps for solving the problem
Don't go on to the next step until the first steps work correctly 100% of the time. These steps are not required and can vary but if you do them in the order specified, it will be easier
- Step 1: Generate a random solution. Create a method that will generate the generic solution (based on number of pegs and possible colors). Print the solution out in the main method
- Step 2: Add a loop to the main method to continue to generate random solutions until the user enters "no" (or "n")
- Step 3: Create a method to get the guess from the user and print it out in the main method.
- Step 4: Add a method that will "play the game". It first gets the solution and then it continues to get a guess from the user until the guess perfectly matches the solution. It will make it easier to debug if you add an output to this method to output the solution. Eventually this statement will need to be removed.
- Step 5: Add a method that counts the number of perfect matches between the solution and the guess. This should be outputted after each guess.
- Step 6: Create an independent method that counts the number of times a given letter occurs in a string (you might want to refer to a previous lab)
- Step 7: Create a method that computes the number of close answers. See the third hint for help if needed