Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ please help 3. Pig is a very simple game. Two players take turns; on each turn, a player rolls a six-sided die as many

c++ please help

image text in transcribed

3. "Pig" is a very simple game. Two players take turns; on each turn, a player rolls a six-sided die as many times as she wishes, or until she rolls a 1. Each number she rolls, except a 1, is added to her score this turn; but if she rolls a 1, her score for this turn is zero, and her turn ends. At the end of each turn, the score for that turn is added to the player's total score. The first player to reach or exceed 100 wins. For example Alice rolls 3, 5, 3, 6, and stops. Her score is now 19 Bob rolls 5, 4, 6, 6, 2, and stops. His score is now 23 Alice rolls 5, 3, 3, 5, 4, and stops. Her score is now 39 (1920) Bob rolls 4, 6, 1. He has to stop, and his score is still 23 (23 ). Etc. As defined above, the first player has an advantage. To make the game fairer, if the first player reaches or exceeds 100, the second player gets one additional turn. (If the second player is the first to reach 100, the first player does not get an additional turn). Write an OO C++ program to implement the game of Pig. You will play against the computer. The computer always goes first, so the player gets one more turn if the computer is the first to reach 100. If both players are tied with 100 or more, each gets another turn until the tie is broken. Must use OO design for full credit. Output should be user friendly

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

Oracle 11G SQL

Authors: Joan Casteel

2nd Edition

1133947360, 978-1133947363

More Books

Students also viewed these Databases questions