Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this code Questions 1- Write a program that simulates a game of dice. In this game, 3 players will take alternate

I need help with this code

image text in transcribed
Questions 1- Write a program that simulates a game of dice. In this game, 3 players will take alternate turns rolling two dice. On each turn, they record the sum of the two dice and add this to their total. If a player rolls a doublet (both dice have the same value), then the player gets to roll again. After each turn (when the 3 players roll), the code checks the sum of each player and the player to reach a total of 15 or more will win the first place and the game stops. The code then checks for the second and third place winners. The code will print out to the user the winners in order. If 2 or all the players hit the same sum, you can consider them all first place winners (for example, if player 1 and 2 hit the same sum that's >= 15 and 3Ird player hits a sum less than 15, then you can say 1St and 31'\"d players win first place and 3rd wins second place). For this question, loopls) and conditionals should be used otherwise you will lose marks. Don't hardcode the output otherwise marks will be deducted. The output should be as follow (note: no user input is required): Player 1 rolls a 1 and a 1 Player 1 now has 2 Player 1 rolls a 6 and a 1 Player 1 now has 9 Player 2 rolls a 3 and a 2 Player 2 now has 5 Player 3 rolls a 5 and a 1 Player 3 now has 6 Player 1 rolls a 4 and a 3 Player 1 now has 16 Player 2 rolls a 6 and a 1 Player 2 now has 12 Player 3 rolls a 6 and a 5 Player 3 now has 17 Player 3 wins the first place with a total of 17 Player 1 wins the second place with a total of 16 Player 2 wins the third place with a total of 12

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Q.1. Taxonomic classification of peafowl, Tiger and cow ?

Answered: 1 week ago

Question

Q .1. Different ways of testing the present adulterants ?

Answered: 1 week ago

Question

Q.1. Health issues caused by adulteration data ?

Answered: 1 week ago

Question

1. Traditional and modern methods of preserving food Articles ?

Answered: 1 week ago