Question: Java 3) Create a Mastermind game, where the pegs (here represent as letters A-F) are chosen at random. (a) Have the Al randomly choose 4

Java  Java 3) Create a Mastermind game, where the pegs (here represent
as letters A-F) are chosen at random. (a) Have the Al randomly

3) Create a Mastermind game, where the pegs (here represent as letters A-F) are chosen at random. (a) Have the Al randomly choose 4 letters A-F. There can be duplicates. This is the hidden message we need to be able to guess (b) Ask the user for 4 letters each being in the range (A-F) (c) It they do not give a four letters in sequence ask again (d) If they give letters not in the range (A-F) ask again (e) Now that we have a valid set of letters, we need to check to see if any of the letters are in the correct space or are at least in the set. (1) We must count each letter that is in the correct spot, basically perfectly matches the 4 hidden letters, and for each one not in the perfect spot is that letter at least in the set not necessarily in that spot (9) If all four are perfectly aligned, you win (h) If you have taken 10 guesses without getting the correct combination, you lose. EXAMPLE GAMEPLAY: 1) What is your guess (A-F) x 4: ABCD Correct Place & Let: 2 Correct Letter: e 2) at 1s your guess (A-F) x 4: AECF Correct Place &Let: 2 Correct Letter: e 3) What is your guess (A-F) x 4: AACC Correct Place &Let: 1 Correct Letter: 1 4) what is your guess (A-F) 4: AAAA Correct Place& Let:e Correct Letter: e 5) what is your guess (A-F)4: EBc Correct Place& Let: 3 Correct Letter: o

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!