Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ please and thank you Pig Dice Game Pig is a simple two player dice game, played with one die. The first player to

In C++ please and thank you image text in transcribed
image text in transcribed
Pig Dice Game Pig is a simple two player dice game, played with one die. The first player to reach or surpass 50 is the winner. Each player takes a turn rolling the dice. They add to the pot with each roll having to decide to roll again and increase the pot, or cash out. The risk being they could lose the amount they've accumulated into the pot. The Rules for each player's die roll. 1. Roll the Dice a. If user rolled a 1 The pot gets set to zero A roll of 2-6 is added to the pot. a. Choice ROLL. Return to Step 1 i. The other player goes to step 1 , b. User can choose to hold or roll again. 2. b. Choice HOLD i. Increment Player score by the pot amount. ii. Pot gets set to 0. second player gets to roll and goes to Step1 Program Requirements . Before each opponent begins rolling o Output the score for the person and the computer o Output the opponents whose turn is beginning and ask the user to hit enter to continue With each dice roll Output the die value, and amount of the round pot. If it's the users roll ask if they want to roll again (R) or Hold (H). Your program should allow r, R, h or H as valid input. If input is anything else, ask the user again until valid input is obtained o o o The Al will continue playing until the round pot is 20 or more Once a player's score is greater or equal to 50 then they have won, it will no longer ask if they want to keep rolling the die or not. Once there is a winner o Score totals are output along with who the winner was. User or Computer o Player is asked if they want to play again Y or N. Valid input should be y, Y, or n, N When a new game starts the starting roll goes to the player that did not roll last. If the User rolled last in the previous game, then the computer rolls first and vice versa. When the program first begins, the player will make the first roll of the first game . o The Al will continue playing until the round pot is 20 or more Once a player's score is greater or equal to 50 then they have won, it will no longer ask if they want to keep rolling the die or Once there is a winner not. Score totals are output along with who the winner was. User or Computer Player is asked if they want to play again Y or N. Valid input should be y, Y, or o o . When a new game starts the starting roll goes to the player that did not roll last. If the User rolled last in the previous game, then the computer rolls first and vice versa. When the program first begins, the player will make the first roll of the first game Development Notes: . You will need a way to roll dice in your program. The rand() function works well, but returns an integer. If we want numbers 0-9 we can get the value modulus 10 . Call srand0 with a value to seed it. It's common to seed it with the current computer clock, include ctime, and then call srand(time(O)) to Example core You: AI0 layers Turn ie Roll 6 Pot :R)ll again or (H)old e ou must enter R or H (R)oll again or (H)old? r ie Roll3 Pot:9(R)ll again or (old? r ie Roll :2 Pot: 11 ()1 again or (H)old?r ie Roll :5Pot : 16 ie Roll:6 Pot : 22 again or (Hjold? h R)oll again or (Hold? r core You22 AI ie Roll:6Pot: 6 ie Roll :2Pot ie Roll 1: BUST AI: layers Turn ie Roll : 6 Pot: ie Roll 1: BUST (R)oll again or (Hoo1d? r core You 22

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

More Books

Students also viewed these Databases questions

Question

2. Identify the purpose of your speech

Answered: 1 week ago