Question: Pig ( pig ) C + + program You are coding a simple game called Pig. Players take turns rolling a die. The die determines

Pig (pig)
C++ program
You are coding a simple game called Pig. Players take turns rolling a die. The die determines how many points they get. You may get points each turn your roll (turn points), you also have points for the entire game (grand points). The first player with 100 grand points is
the winner. The rules are as follows:
Each turn, the active player faces a decision (roll or hold):
Roll the die. If its is a:
1: You lose your turn, no turn total points are added to your
grand total.
2-6: The number you rolled is added to your turn total.
Hold: Your turn total is added to your grand total. Its now the
next players turn.
Problem Features.
These are additional details to help you
Make a simple AI with a random number. Each tun decide what solve the programming problem.
the computer will do by rolling a 6 sided die, a D6: on 1-3 hold, on
a 4-6 roll again.
Requirements.
These are the requirements for the assignment. This means they are general and apply to the entire assignment, rather than one specific part. Not every assignment will have a requirements
section.
Your code must be readable inside Canvas (no garbage files).
Your code must compile under the gcc compiler (g++ compiler is an alias to gcc).
Your code must execute under Ubuntu 14.00 or greater.
Your output must be logically correct.
Do not optimize for computer performance.
Global variables in any form are forbidden. This includes #define statements, too. You can, and should, put classes and structs right under your include statements and using namespace std; statement.
You cannot use any data structures from the standard template library. No or or anything like that. You can use C-Style arrays, however. You can also build your own dynamic memory structures.
Include a Source File Header. Ill look for comments like this:
// pig.cpp
// Pat Jones, CISP 413
//12/34/56
Include a ProgramGreeting function which runs at the very start of the program. You can display the same information as in your source file header on the terminal.
Specification Bundles.
You want to comment where your code implementing the individual specification begins. You want me to find them. Use the grep trick (style, below) to prove you can see them. I specification documenting the start of a feature is plenty - you do not need to put a comment everywhere the implementation code appears.
"C" Specification Bundle.
// Specification C1- Fixed Seed
This program will need to generate random numbers. Set the random number seed to a specific integer. That way, it will always generate the same random number sequence - easier to fix bugs that way. Use the unsigned variable seed to hold the seed value.
// Specification C2- Student Name
Allow name to accept first plus last name (ie 2 words). Do not use 2 cins or 2 string variables, just 1 variable. Call this variable hPlayer. Read this in from the keyboard after your program greeting runs. Display it somewhere in the output.
// Specification C3- Numeric Menu
Use a numeric menu to collect the human players actions. See figure 1 for an example menu.
// Specification C4- Three Functions
Include at least three functions in your program. Put this specification comment above your function prototype(s).
"C" Bundle Menu Options.
1. Roll
2. Hold
3. Quit
Figure 1: Allowable menu options for
this bundle.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!