Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

TO START, MUST BE ORGINAL CODE AND WORK. Any answers will be cross referenced on Chegg to make sure it is original work. This program

TO START,

MUST BE ORGINAL CODE AND WORK.

Any answers will be cross referenced on Chegg to make sure it is original work.

This program must be written in C++.

THERE MUST BE .CPP WITH CORRESPONDING .H FILES.

Please make it easy to tell what code goes in what files

Must have different classes like a guess class and secret code class and use operator overloading to compare them.

Overall not a very difficult program but must be done object oriented with .cpp and .h files

Here is the description of the assignment:

The purpose of this assignment is to:

1. Implement objects with C++.

2. Customize public interfaces by overloading operators for a class.

3. Manipulate instances of objects to simulate the game of Mastermind.

After writing the code that implements classes for the objects in your game, write a driver program that uses your class objects to simulate a game of Mastermind. Read the following program requirements and implementation notes carefully:

  1. This program is a console application.
  2. Your program must utilize operator overloading. You may decide on the operators that make the most sense for your application.
  3. Your program should generate a secret code for the user to guess.
  4. The user will enter guesses at the keyboard.
  5. The program will provide feedback as described in the game rules for each player guess.
  6. The player will be allowed a maximum of 10 guesses.
  7. The program should terminate with either a winning or losing message. In the event of a losing message, the secret code should be revealed.
  8. When an error in reading data is detected, your program should alert the user in a helpful manner (think of it as customer service to the user).
  9. Your code must be fully commented but focus on the main programming blocks.

IN ADDITION, HERE ARE THE RULES FOR THE GAME:

1. For each of the pegs in the guess that is the correct color and in the correct position, the codemaker will give one black peg. If a guess scores four black pegs, then the codebreaker (user).secret code.

2. For each of the pegs in the guess that is a correct color in an incorrect position, the codemaker will give one white peg. Together, there will be no more than four black and white pegs for each move.

3. The color sequence can contain pegs of the following colors: red, yellow, green, blue, white, and black. A color can be used any number of times in the sequence. All four pegs of the secret sequence will contain a color - no blanks/empties are allowed.

4. Each guess must consist of four peg colors - no blanks.

5. The codebreaker has 10 guesses to find the secret sequence.

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

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions