﻿ The dice game is a turn-based dice game that allows two players to… - Essay solutions

## The dice game is a turn-based dice game that allows two players to…

The dice game is a turn-based dice game that allows two players to… The dice game is a turn-based dice game that allows two players to compete to see who can reach a desired score first. Players take turns selecting a combination of dice to roll, with the values of their rolled dice are added together into a single score. Each player’s score is accumulated over each iteration of play. When a player’s total score is equal to the end score, the game ends and the winner is declared. If a player’s total score increases beyond the end score, the player’s score is reduced by the excess value. Users can roll a variety of dice below.- 1d20  – 1-3d6 – 1-5d4 Write a program that allows two players to play the dice game. Your program should consist of the following functions:RollDie(num_sides) – Generate a random number within a specified range. Parameters: num_sides – int Return: random number between 1 and num_sides inclusive RollDice(num_dice, num_sides) – Use RollDie to generate one or more numbers and find the sum of all. Parameters: num_dice – int num_sides – int Return: total – int GetUserInput() – Accept and validate user input from a single user for num_dice and num_sides. Parameters: None Return: num_dice – int num_sides – int. Must return only combinations in listed dice above. Assumptions: User enters an integer or float value. PlayDice(end_score=100) – Alternate turns for 2 player gameplay until one player reaches the end_score. Parameters: end_score – int default to 100 Return: None Requirements: 1. Display a player’s current score at the start of their turn. 2. Get their input for their next roll 3. Roll the dice 4. Display a user’s individual roll total after a roll. 5. Compute a player’s new score after a roll   a. If the player’s total + roll is equal to the end score, the game is over.   b. If the player’s total + roll is less than the end score, the game continues and you must display the new total before the next player takes a turn.   c. If the player’s total + roll is greater than the end score, the player ‘s score is reduced by a value equal to the end score minus the player’s total + current roll score   d. Display the name of the winner and the scores of both players Computer Science Engineering & Technology Python Programming CIS 100

Don't use plagiarized sources. Get Your Custom Essay on
The dice game is a turn-based dice game that allows two players to…
Just from \$13/Page

## 3. Sue likes every class John likes. Rephrased: All FOL: This question was created from hw4_onWeek7and8_dueWeek8S.docx3. Sue likes every class John likes. Rephrased: All FOL: This question was created from hw4_onWeek7and8_dueWeek8S.docx

Engineering & Technology Computer Science Share QuestionEmailCopy link This question was created from hw4_onWeek7and8_dueWeek8S.docx Comments (0) Don't use plagiarized sources. Get Your Custom Essay on 3. Sue likes every class

## In Java 8 the default keyword may be used to …… Select answers…In Java 8 the default keyword may be used to …… Select answers…

In Java 8 the default keyword may be used to …… Select answers… In Java 8 the default keyword may be used to ……Select answers that make the preceding statement