Question: I need help with programming a game in C++. The rules are listed below. e rules are listed below. For this assignment, you will write

I need help with programming a game in C++. The rules are listed below. I need help with programming a game in C++. The rules aree rules are listed below.

For this assignment, you will write a program to play the game Mastermind. Please see https://en.wikipedia.org/wiki/Mastermind (board game) for details of how to play the game. Your program should print out instructions for the game. A game consists of trying to guess a secret randomly generated, 4-digit code where each digit is a number from 1 to 6. A player will have 12 guesses to guess the correct 4-digit code. After each guess, your program must inform the player how many digits were guessed correctly in the correct location and how many digits were guessed correctly but in the wrong location. If the player guesses correctly, then your program should congratulate the player on successfully guessing the correct answer. Your program must check that the user enters a valid guess, i.e., that it is exactly 4 digits and that each digit is a number from 1 to 6. After finishing a game, your program should ask the user if they want to play again or quit the program. The program should play another game unless the user chose to quit the program. Your program must include and properly use a function to check if the guess entered by the user is valid or not. The function should return true or false. Your program must include and properly use a function to count the number of digits of the guess that are correct and in the correct position. This function must take as input the guess and the secret code to be guessed. The function should return the number of digits that are correct and in the correct location. Your program must include and properly use a function to count the number of digits of the guess that are correct and in the incorrect position. This function must take as input the guess and the secret code to be guessed. The function should return the number of digits that are correct and in the incorrect location. Your program should print out the secret answer at the beginning of each round for grading/debugging purposes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!