Question: Write a program in Python that will play the game of MAstermind wher the computer chooses the hidden colors, and the human player attempts to
Write a program in Python that will play the game of MAstermind wher the computer chooses the hidden colors, and the human player attempts to guess the hidden colors.



The Game: In the game of Mastermind, one player, the codemaker (in this case the computer) chooses four colored "pegs" in a particular order. The codebreaker (the human player) tries to guess the chosen colors by placing four pegs in the guessed order. For each guess, the codemaker provides a clue about how well the codebreaker guessed. The codebreaker has 10 guesses to break the code. Hidden Colors The codemaker will randomly choose four colors as the hidden colors. You can define a global list: ALL COLORS 'red Orange yellow green blue purple The hidden colors that are chosen will not be displayed to the codebreaker. Opponent Guess The codebreaker will be asked to choose four colors, in a particular order, to guess what the hidden colors are. For simplicity, you may assign a number to each color so it is easier for the user to enter a guess. For instance, you can display a message like the following: Make a guess of four colors: 0 red. 1 Orange 2 yellow green. 4 blue 5 purple Guess color: 0 Guess color: 1 Guess color: 4 Guess color: 0 Your guess is: 'red Orange blue red. J
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
