Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE HELP CREATE THIS PROGRAM USING C++ ONLY ON VISUAL STUDIO Pig Dice Game Pig is a simple two player dice game, played with one

PLEASE HELP CREATE THIS PROGRAM USING C++ ONLY ON VISUAL STUDIO

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 theyve accumulated into the pot.

The Rules for each players die roll. 1. Roll the Dice. a. If user rolled a 1, i. The pot gets set to zero ii. The other player goes to step 1. b. A roll of 2-6 is added to the pot. 2. User can choose to hold or roll again. a. Choice ROLL. Return to Step 1. b. Choice HOLD. i. Increment Player score by the pot amount. ii. Pot gets set to 0. iii. second player gets to roll and goes to Step 1.

Program Requirements: Before each opponent begins rolling... Output the score for the person and the computer. 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 its 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. The AI will continue playing until the round pot is 20 or more. Once a players 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 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 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.

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 srand() with a value to seed it. Its common to seed it with the current computer clock, include ctime, and then call srand(time(0)).

Submission Notes: Save your project with your name and assignment number. Include your name inside your source code (at the top of the source file) Make sure to submit your whole project (Zip the whole project) to Canvas before Sunday February 10 by 11:59PM.

Example:

image text in transcribedimage text in transcribed

CAWindows)system32\cmd.exe Score You : : Players Turn Die Rol1:6 Pot: 6 (R)oll again or (H)old? e ou must enter R or H (R)oll again or (H)old? r Die Roll:3 Pot :9 (R)oll again or (H)old? r Die Roll2Pot 11 (R)oll again or (H)old? r Die Rol1 : 5 Die Roll:6 Pot 22 (R)oll again or (H)old? h Pot: 16 (R)oll again or (H)old? r Score You: 22 AI 0 AI Turn Die Roll:6 Die Rol12 Die Rol1 1:BUST Pot 6 Pot 8 Score You: 22 Players Turn Die Roll:6 Pot : 6 Die Rol1 1: BUST (R)oll again or (H)old? r Score You 22 AI 0 C:Windowslsystem32\cmd.exe AI Turn Die Rol1 5 Die Rol1:4 Die Rol1 1: BUST Pot5 Pot9 Score You: 44 AI 22 Players Turn Die Rol1 :6 Pot 6 no need to keep rolling Congratulations you won !!! Final Score You 50 AI: 22 Do you want to play the game again? Y Or lN You must only enter Y or N. Do you want to play the game again? Y Or N Score You : A1 : AI Turn Die Roll: 5 Die Rol1:6 Die Roll 3 Pot:5 Pot 11 Pot14

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

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

More Books

Students also viewed these Databases questions