Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java program Mastermind or Master Mind is a code-breaking game for two players. One player becomes the code- maker, the other the code-breaker. The game

java program

Mastermind or Master Mind is a code-breaking game for two players. One player becomes the code- maker, the other the code-breaker. The game rules of your program:

  • The code-maker chooses a pattern of four code Letters as a subset of the following 8 alphabetic letters { A, B, C, D, E, F, G }.

  • The code cannot include duplicates and blanks.

  • The chosen pattern is placed in an input file, entered by the code-maker but not known by the code-

    breaker.

  • The code-breaker tries to guess the pattern in the right order in both orders, within twelve turns.

  • Each guess is made by placing a row of code patterns on the decoding board.

  • Once placed, the program provides feedback by placing from zero to four key characters after each

    row of guess. Character Y feedback is placed for each code patters from the guess, which is correct in both character and position. Character X feedback indicates the existence of a correct Character in the code but placed in the wrong position.

  • If the guess of code-breaker is already has been provided in one of the previous steps, the game refers back to the feedback number. The duplicated guess will not be counted.

  • The program print at the end all the guesses

    Hint: Use a 2D array and place the code-maker pattern in the first row. Then all code-breaker guesses in the following rows. Then make simple comparisons. Your program will be a modified version of the

  1. Example: If the code-maker input in the file F G B A

    Code-breaker Guess: A B C D Feedback 1: X X Code-breaker Guess: A B E F Feedback 2: X X X Code-breaker Guess: A B E G Feedback 3: X X X Code-breaker Guess: A B F G Feedback 4: X X X X Code-breaker Guess: B A G F Feedback 5: X X X X Code-breaker Guess: A B E G Repeated guess! Feedback 3: X X X

  2. Code-breaker Guess: G F B A Feedback 6: Y Y X X

    Code-breaker Guess: F G B A Feedback 7: You win by 7 rounds

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions