Mastermind is a code-breaking game between two players, the codemaker (in this case the computer) and the codebreaker (the player). How to Play See the following video https://www.youtube.com/watch?v=XwuwWTH39ac. Project Requirements The goal of the project is to implement a text-based/menu-driven Mastermind game.  The game will include a menu from which the user will choose: See Rules Play Game See Highest Score

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Use Java language ONLY. 

Do not Use C++ code please. I have a source file created using C++

Mastermind is a code-breaking game between two players, the codemaker (in this case the computer) and the codebreaker (the player).

How to Play

See the following video https://www.youtube.com/watch?v=XwuwWTH39ac.

Project Requirements

The goal of the project is to implement a text-based/menu-driven Mastermind game. 

The game will include a menu from which the user will choose:

  1. See Rules
  2. Play Game
  3. See Highest Score
  4. Quit
  • When the user chooses to play a game, the computer will generate a three-position code using five colors (Red/Blue/White/Yellow/Green).

    The player will try to break the code by choosing a color for each of the three positions available - color repeats are allowed. Example: R   G   B (Red-Green-Blue)

The computer will provide feedback using three pins (one for each color) placed in non-related order:

    • Red Pin (R)– A color is part of the code and has been placed on the right position.
    • White Pin(W) – A color is part of the code but has been placed on the wrong position.
    • No Pin (O)– The color is incorrect.

The game ends when either:

    • The player wins. Breaks the code – three colors on the exact positions as initially generated by the computer. The player’s score is the round when the code was broken (1-10).
    • The player loses. No code is broken after ten attempts. No score is awarded.
  • Example

Assume the computer has generated the following code:

R   G   B

A possible output at the end of the second round could be:

                        Colors                                      Pins

                        R   R   R                                     R   O   O

                        R   B   Y                                     R   W   O

  • At the end of each game, the system will read in the score stored in “highscore.txt”.
    • If the file does not exist, it will create one with the current player as the high score (name & score).
    • If the user has scored higher than the value in the file, it will replace the text file with the current player’s name and score. 
    • Otherwise, the text file will remain intact.
  • The user should be able to play as many times as he/she wishes.

 

Notes about Functionality, Implementation & Program Requirements:

  1. The program should validate the information entered by the user and display the appropriate error messages.
  2. The code should be self-documented, including:
      • Descriptive Comment indicating
        • Author
        • Program Summary
        • IPO Chart
      • Appropriate comments throughout the code that highlight, among other things, the implementation of the algorithm.
      • Adequate use of spaces and indentation so the source code is easy to read when printed out.
    1. Functional decomposition implementation of the algorithm. Must define at least four different functions. Make sure to include functions that exemplify void vs. return-type, and value vs. reference parameters.
    2. Two-Dimensional array implementation. The mastermind color & pin boards must be implemented using parallel two-dimensional arrays.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY