Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THIS IS A C++ CODE. You are coding a simple game called Pig. The rules are as follows: Two players (you and the computer) are

THIS IS A C++ CODE.

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.

Roll: generate a random number between 1 and 6. Results are: * 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 Structured Programming or Object Oriented Programming Techniques.

Use function prototypes and comment them. Every program you write in this class has this constraint EVEN IF NOT EXPRESSLY STATED.

Compiler warnings are NOT acceptable. Compiler warnings result from the compiler finding a potential problem in your source file. They are not tolerated in a production environment. Your code must compile clean. 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.

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.

Keep count of the number of turns it took to win/lose.

Create a more sophisticated AI (ex: look at the difference between

the player and computer scores and adjust the random numbers to make the AI take more or less risk.). Note: there is a competition on building AIs for this - keep your new AI simple.

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

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions

Question

2. Do you agree that unions stifle creativity? Why or why not?

Answered: 1 week ago

Question

Describe the Indian constitution and political system.

Answered: 1 week ago

Question

Explain in detail the developing and developed economy of India

Answered: 1 week ago

Question

Problem: Evaluate the integral: I = X 52+7 - 1)(x+2) dx

Answered: 1 week ago

Question

What is gravity?

Answered: 1 week ago

Question

What is the Big Bang Theory?

Answered: 1 week ago

Question

Has the priority order been provided by someone else?

Answered: 1 week ago

Question

Compare the current team to the ideal team.

Answered: 1 week ago