Question: Examples of mastermind: http://www.pressmantoy.com/product/mastermind-game/ http://www.industrious.com/mastermind/gamerules.html Objective: Write a python program that will play the MAstermind game where the computer picks hidden colors (that are not

Examples of mastermind:

http://www.pressmantoy.com/product/mastermind-game/

http://www.industrious.com/mastermind/gamerules.html

Objective: Write a python program that will play the MAstermind game where the computer picks hidden colors (that are not displayrdd to the human player) and the human player tries to guess the colors.

Hidden colors: the codemaker (the computer) chooses 4 colors at random to be the hidden colors. you can define a global list: ALL_COLORS = ['red', 'orange', 'yellow', 'green', 'blue', 'purple']

Opponent Guess: The player is asked to coose 4 colors in a certain order to guess what the hidden colors are. You can assign a number to each color to make it easier to input a guess. (for example, 0 is red, 1 is orange, etc.)

Clues: When the player gives a guess, the computer calculates a clue to give info about how accurate the guess is. 2 means the guess is the right color in the correct position. 1 means the guess is the right color, in the wrong position.

If the hidden colors are ['orange', 'purple', 'blue', 'yellow'] and the guess is ['orange', 'red', 'red', 'blue'] the clue could be [1, 2]

The program has to:

a. randomly choose the hidden colors

b. ask the user to ake a guess of the colors

c. test the guess and give a correct clue to the player

d. let the player guess a maximum of 10 times

e. tell the user if the guess was right

The python program also has to use functions for all of the main tasks of the program

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!