Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 image text in transcribed
image text in transcribed
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

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

Step: 3

blur-text-image

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

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

More Books

Students also viewed these Databases questions

Question

=+d. In what units is the real wage in part (c) measured?

Answered: 1 week ago

Question

LO5.2 Discuss government failure and explain why it happens.

Answered: 1 week ago