Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a. Create the logic for a dice game. The application randomly ?throws:? five dice for the computer and five dice for the player. After each

a. Create the logic for a dice game. The application randomly ?throws:? five dice for the computer and five dice for the player. After each random throw, store the results in an array. The application displays all the values, which can be from 1 to 6 inclusive for each die. Decide the winner based on the following hierarchy of die values, which can be from 1 to 6 inclusive for each die. Decide the winner based on the following hierarchy of die values. Any higher combination beats a lower one; for example, five of a kind beats four of a kind.

Five of a kind

Four of a kind

Three of a kind

A pair

For this game, the numeric dice values do not count. For example, if both players have three of a kind, it?s a tie, no matter what the values of the three dice are. Additionally, the game does not recognize a full house (three of a kind plus two of a kind). Figure 6-20 shows how the game ight be played in a command-line environment

b. Improve the dice game so that when both players have the same number of matching dice, the higher values wind. For example, two 6s beats two 5s

Command Prompt Computer rolled: 5 2 6 4 2 You rolled: 1 1 1 2 3 Computer has 2 of a kind You have 3 of a kind You win X ^

Step by Step Solution

3.49 Rating (152 Votes )

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

Document Format ( 2 attachments)

PDF file Icon
609aadc196f88_30881.pdf

180 KBs PDF File

Word file Icon
609aadc196f88_30881.docx

120 KBs Word File

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

Programming Logic & Design Comprehensive

Authors: Joyce Farrell

9th edition

978-1337102070

More Books

Students also viewed these Programming questions

Question

Box

Answered: 1 week ago

Question

Subtract the polynomials. (-x+x-5) - (x-x + 5)

Answered: 1 week ago

Question

2. Which animal species would have the longest axonspg109

Answered: 1 week ago