Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Two player Dice game In C++ The game of ancient game of horse, not the basketball version, is a two player game in which the

Two player Dice game In C++

The game of ancient game of horse, not the basketball version, is a two player game in which the first player to reach a score of 100 wins. Players take alternating turns. On each players turn he/she rolls a six-sided dice. After each roll:

a. If the player rolls a 3-6 then he/she can either Roll again or Hold. If the player holds then the player gets all of the points summed up during his/her turn added to their previous total. Each player starts with 0 points. It then alternates to the other players turn.

b. If the player rolls a 1 or a 2 then the player loses a turn and the player gets no new points on this roll and it becomes the other players turn.

If a player reaches 100 or more points after holding the then the player wins unless the other player scores more points on their final turn. After one player has reached 100+ points and holds the other player will be allowed one more series of rolls and either falls short of the previous players points or exceeds the other players total and hence they win.

Write a C++ program that plays the game of horse where one player is a human and the other player is the computer. Allow the person to enter an h for hold and an r for roll. The computer (player) program should follow the following protocol:

It should keep rolling on the computers turn until it has accumulated at least 10 points before it is allowed to hold and it must hold after it reaches at least 10 or more. Just as the rules state above, it will lose its turn if it rolls a 1 or a 2 and no points are accumulated for the computer. If the computer goes over 100 points the human is allowed, just as above, to roll until it gets more points than the computer or loses his/her turn. The person/human should roll first.

Your program should announce the name of the person winning or the name computer wins.

Your program must use C++ built in intrinsic functions to do random generation to simulate the rolling of a six sided die. As well as any other built in functions you wish to use.

Your program should also contain at least two user defined functions for the users turn and also one for the computers turn. You will probably want more than this, possibly nesting functions, to do the rolling and totaling and to determine winners.

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

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions

Question

politeness and modesty, as well as indirectness;

Answered: 1 week ago