Problem D: Different Dice Game Consider the following game for two players: The first player rolls a pair of dice of fair six-sided dice. If the two dice show different numbers, the player's score is the larger of the two numbers. Otherwise, the player's score is the sum of the two numbers. At this point, the player is asked if they want to remove their lower die and re-roll one die. If they say no, the player keeps her score and their turn is over. If they say yes, then they roll one more die and the number showing on this die replaces the lower of the original two rolls. Then these two dice rolls are scored accordingly. (For example, if the initial roll was a 2 and 5, if the player doesn't roll again, she gets 5 points. If she does roll again and obtains a 4, her score is still 5. If she rolled again and obtained a 6, her score would be a 6. If she rollwed again and obtained a 5, her score would be a 10.) The second player goes after the first, doing the exact same steps as the first player. When the second player finishes his turn, the game ends. The winner is the person with the higher score. If both players have the same score, they tie. Write a program to simulate this game between two players. Print out the winner at the end (or the fact that the players tied.) Sample Run Player 1, you rolled a 4 and a 3. Do you want to reroll(yes/no)? yes Your second roll was a 5. Your final score is 5. Player 2, you rolled a 3 and a 3. Do you want to reroll(yes/no)? no Your final score is 6. Player 2, you win. Sample Run Player 1, you rolled a 2 and a 6. Do you want to reroll(yes/no)? no Your final score is 6. Player 2, you rolled a 2 and a 2. Do you want to reroll(yes/no)? yes Your second roll was a 6. Your final score is 6. Both players tied. Sample Run Player 1, you rolled a 5 and a 4. Do you want to reroll(yes/no)? yes Your second roll was a 5. Your final score is 10. Player 2, you rolled a 3 and a 4. Do you want to reroll(yes/no)? no Your final score is 4. Player 1, you win. In Python Code

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Problem D: Different Dice Game Consider the following game for two players: The first player rolls a pair of dice of fair six-sided dice. If the two dice show different numbers, the player's score is the larger of the two numbers. Otherwise, the player's score is the sum of the two numbers. At this point, the player is asked if they want to remove their lower die and re-roll one die. If they say no, the player keeps her score and their turn is over. If they say yes, then they roll one more die and the number showing on this die replaces the lower of the original two rolls. Then these two dice rolls are scored accordingly. (For example, if the initial roll was a 2 and 5, if the player doesn't roll again, she gets 5 points. If she does roll again and obtains a 4, her score is still 5. If she rolled again and obtained a 6, her score would be a 6. If she rollwed again and obtained a 5, her score would be a 10.) The second player goes after the first, doing the exact same steps as the first player. When the second player finishes his turn, the game ends. The winner is the person with the higher score. If both players have the same score, they tie. Write a program to simulate this game between two players. Print out the winner at the end (or the fact that the players tied.) Sample Run Player 1, you rolled a 4 and a 3. Do you want to reroll(yes/no)? yes Your second roll was a 5. Your final score is 5. Player 2, you rolled a 3 and a 3. Do you want to reroll(yes/no)? no Your final score is 6. Player 2, you win. Sample Run Player 1, you rolled a 2 and a 6. Do you want to reroll(yes/no)? no Your final score is 6. Player 2, you rolled a 2 and a 2. Do you want to reroll(yes/no)? yes Your second roll was a 6. Your final score is 6. Both players tied. Sample Run Player 1, you rolled a 5 and a 4. Do you want to reroll(yes/no)? yes Your second roll was a 5. Your final score is 10. Player 2, you rolled a 3 and a 4. Do you want to reroll(yes/no)? no Your final score is 4. Player 1, you win. In Python Code
Problem D: Different Dice
Game
Consider the following game
for two players:
The first player rolls a pair of
dice of fair six-sided dice. If the
two dice show different
numbers,
the player's score is the larger
of the two numbers. Otherwise,
the player's score is the sum of
the
two numbers.
At this point, the player is
asked if they want to remove
their lower die and re-roll one
die. If
they say no, the player keeps
her score and their turn is over.
If they say yes, then they roll
one
more die and the number
showing on this die replaces
the lower of the original two
rolls. Then
these two dice rolls are scored
accordingly. (For example, if
the initial roll was a 2 and 5, if
the
player doesn't roll again, she
gets 5 points. If she does roll
again and obtains a 4, her
score is still
5. If she rolled again and
obtained a 6, her score would
be a 6. If she rollwed again and
obtained
a 5, her score would be a 10.)
The second player goes after
the first, doing the exact same
steps as the first player.
When the second player
finishes his turn, the game
ends. The winner is the person
with the
higher score. If both players
have the same score, they tie.
Write a program to simulate
this game between two
players. Print out the winner at
the end (or
the fact that the players tied.)
Sample Run
Player 1, you rolled a 4 and a 3.
Do you want to reroll(yes/no)?
yes
Your second roll was a 5.
Your final score is 5.
Player 2, you rolled a 3 and a 3
Do you want to reroll(yes/no)?
no
Your final score is 6.
Player 2, you win.
Sample Rum
Player 1, you rolled a 2 and a 6.
Do you want to reroll(yes/no)?
no
Your final score is 6.
Player 2, you rolled a 2 and a 2.
Do you want to reroll(yes/no)?
yes
Your second roll was a 6
Your final score is 6.
Both players tied.
Sample Run
Player 1, you rolled a 5 and a 4
Do you want to reroll(yes/no)?
.
yes
Your second roll was a 5.
Your final score is 10.
Player 2, you rolled a 3 and a 4.
Do you want to reroll(yes/no)?
по
Your final score is 4.
Player 1, you win.
Transcribed Image Text:Problem D: Different Dice Game Consider the following game for two players: The first player rolls a pair of dice of fair six-sided dice. If the two dice show different numbers, the player's score is the larger of the two numbers. Otherwise, the player's score is the sum of the two numbers. At this point, the player is asked if they want to remove their lower die and re-roll one die. If they say no, the player keeps her score and their turn is over. If they say yes, then they roll one more die and the number showing on this die replaces the lower of the original two rolls. Then these two dice rolls are scored accordingly. (For example, if the initial roll was a 2 and 5, if the player doesn't roll again, she gets 5 points. If she does roll again and obtains a 4, her score is still 5. If she rolled again and obtained a 6, her score would be a 6. If she rollwed again and obtained a 5, her score would be a 10.) The second player goes after the first, doing the exact same steps as the first player. When the second player finishes his turn, the game ends. The winner is the person with the higher score. If both players have the same score, they tie. Write a program to simulate this game between two players. Print out the winner at the end (or the fact that the players tied.) Sample Run Player 1, you rolled a 4 and a 3. Do you want to reroll(yes/no)? yes Your second roll was a 5. Your final score is 5. Player 2, you rolled a 3 and a 3 Do you want to reroll(yes/no)? no Your final score is 6. Player 2, you win. Sample Rum Player 1, you rolled a 2 and a 6. Do you want to reroll(yes/no)? no Your final score is 6. Player 2, you rolled a 2 and a 2. Do you want to reroll(yes/no)? yes Your second roll was a 6 Your final score is 6. Both players tied. Sample Run Player 1, you rolled a 5 and a 4 Do you want to reroll(yes/no)? . yes Your second roll was a 5. Your final score is 10. Player 2, you rolled a 3 and a 4. Do you want to reroll(yes/no)? по Your final score is 4. Player 1, you win.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 4 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education