subject

Program Specifications Your program will play the mastermind game as follows:
1. Prompt for the 4 digit key we will play with.
2. Prompt the user for a guess.
a. we check to see if the guess is exactly length 4
b. we check to see if the guess contains all numbers
C. we check to see if the guess has no repeats
Any violation of these rules prints an error message and prompts for a guess again. Bad input does not
count as a guess.
3. End the game if:
a. the guess is correct. Print out a winner message
b. it was the last guess (the twelfth) and the guess is incorrect. Print out a loser message and the
value of the key
4. If no end condition occurs, print out how many of the guess numbers are exactly right (correct number in the
correct position) and how many of the guess numbers are correct but not in the correct position. Example. The
key is 1234 and the guess is 4256. The feedback would be 1 number exactly correct (2) and 1 number in the
wrong position (4). That is, each digit in the
guess produces at most one result (exact or wrong position).
5. You should keep a history of guesses so that the user can see how they are progressing.
6. Continue the game until an end condition occurs

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 21:30, dpazmembreno
Ajeweler designing a pin has decided to use five stones chosen from diamonds, rubies, and emeralds. in how many ways can the stones be selected?
Answers: 3
image
Computers and Technology, 22.06.2019 02:00, hannahliebl2000
What is the largest decimal number that can be represented by a binary number with 4 place values? (remember, each place in a binary number has a value of a power of 2, starting in the ones place with 20.)
Answers: 3
image
Computers and Technology, 24.06.2019 11:20, isabelperez063
Every telecommunication setup uses two devices: one device to transmit data and one device to receive data. which device transmits frequencies to mobile phones? towers transmit frequencies to mobile phones.
Answers: 1
image
Computers and Technology, 24.06.2019 14:00, Abrahamolve
When creating a field in a table, you must set the to determine what type of data the field can store. field property data type field type data property
Answers: 1
You know the right answer?
Program Specifications Your program will play the mastermind game as follows:
1. Prompt for...

Questions in other subjects:

Konu
Mathematics, 10.02.2021 18:50
Konu
Mathematics, 10.02.2021 18:50