Question: need this in C++ using object oriented techniques You are coding a simple game called Pig. The rules are as follows: Two players (you and
need this in C++ using object oriented techniques
You are coding a simple game called Pig. The rules are as follows:
Two players (you and the computer) are racing to reach 100 points.
Each turn, the active player faces a decision:
Hold: take your turn total and add it to the player's overall total. The next player becomes active.
Play: Roll a Dice: and uses the following scenarios depending on the number rolled.
1 Lose turn, no turn total added to overall total. All the points you have accumulated this turn are lost.
2..6 Add this number to the turn total. Player goes again.
Constraints.
Use Object Oriented Programming Techniques.
Your program should have two classes Dice and Player. Each need to have a header file and cpp file
Each class should have suitable constructor(s) and getters and setters
Dice class should have a method called roll that returns a random number between 1 and 6
Player Class should have methods hold, play
The game stops when either of the players reaches 100
Use function prototypes and comment them. Every program you write in this class has this constraint EVEN IF NOT EXPRESSLY STATED.
Make a simple AI by randomly generating a number 1,2,3 - hold,
4,5,6 - roll, etc.
Start your source file with a file header. This includes program name, 1 sentence description, your name, class number and the date. Every program you write in this class has this constraint EVEN IF NOT EXPRESSLY STATED.
Your driver program should offer a pleasing UI
Display a program greeting as soon as the program runs. This introduces the program and tells your clients what it does. Try to keep this short - 1, 2 sentences. Every program you write in this class has this constraint EVEN IF NOT EXPRESSLY STATED.
Use white space and comments to make your code more readable.
Every program you write in this class has this constraint EVEN IF NOT EXPRESSLY STATED.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
