Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions

Question

I want a project (LONG REPORT) about Hygroscopic cycle...

Answered: 1 week ago