Use Java language ONLY 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 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).

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Use Java language ONLY

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.

Grading Rubric

Documentation & Algorithm (5)                                                                                   ______

Menu-Driven interface (10)                                                                                          ______

  • Option driving
  • Looping

See Rules (5)                                                                                                                 ______

Game Implementation (25)                                                                                         ______

  • Generate code
    Random function seeding & color generation
  • Prompt player for guess
  • Provide feedback
  • Determine win/lose
  • Loop up to ten rounds

Array Implementation (20)                                                                                           ______

  • Two-Dimensional Arrays
  • Parallel Arrays

File Manipulation (20)                                                                                                   ______

  • See highest score
  • Create/Update highscore.txt

Functional Decomposition (20)                                                                                    ______

  • Methods

Game Interface (5)                                                                                                      ______

  • Add you own creativity

Total (110/100) 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education