Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that allows a single Player (the user) to play a simple three dice game of chance against a single Opponent (the computer).

Write a program that allows a single Player (the user) to play a simple three dice game of chance against a single Opponent (the computer).

Game Description:

There is a single Player (human), with three dice.

There is a single Opponent (computer), with three dice.

Each die is 4 sided, and each of its sides is labeled with a unique number: 2, 3, 5 or 7.

When a die is rolled it stops with one of its sides facing down, we will call this the value of the die roll.

A game is made up of rounds, a single round is played as such:

1. The computer Opponent rolls its dice

2. The dice are displayed

3. The Player rolls their dice

4. The dice are displayed

5. A determination is made as to who won the round, this determination is made via the following rules:

A Triple is when all the dice have the same number on their top faces, the value of the Triple is this common value.

A Pair is when exactly two of the dice have the same number on their top faces, the value of the pair is this common value.

A Straight is when the three dice values can be arranged into a consecutive sequence, there are exactly two possible Straights 2 3 5 in any order and 3 5 7 in any order. Junk is anything that is not a Triple, a Pair or a Straight.

Larger values beat smaller values, same values are a tie.

Any Triple beats any Straight.

Any Triple beats any Pair.

Any Triple beats any Junk.

Two Triples are compared by their respective Triple values.

Any Straight beats any Pair.

Any Straight beats any Junk.

Any 3 5 7 Straight beats any 2 3 5 Straight.

Any Pair beats any Junk.

Two Pairs are first compared by their respective Pair values, and then by their respective non-common die values. 6. The result of the round (with respect to the Player) is announced.

7. The result of the round (with respect to the Player) is tallied, by increasing the number of player wins, ties, or loses by one.

The player is asked if they wish to play another round.

When the game is over, the results of the game are announced: how many rounds the player played; how many they won; how many they tied; how many they lost.

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

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

More Books

Students also viewed these Databases questions