Assignment Description This program will simulate part of the game of Yahtzee! This is a dice game that involves rolling five dice and scoring points based on what show up on those five dice. The players would record their scores on a score card, and then total them up, and the player with the larger total wins the game. A Yahtzee score card has two portions: The upper portion has spaces for six scores, obtained by adding up all of the 1's, 2's, 3's, etc. The lower portion has special scores for various combinations: Three of a kind -- at least 3 dice are the same number; the score is the sum of all five dice Four of a kind -- at least 4 dice are the same number; the score is the sum of all five dice Small straight -- four consecutive numbers are represented, e.g. 2345; the score is 25 points Large straight -- five consecutive numbers are represented, e.g. 23456; the score is 30 points Full House -- three of one kind, two of another; the score is 30 points Yahtzee! -- five of a kind; the score is 50 points Chance -- nothing special; the score is the sum of all five dice Function of the Homework. This function should be the entry point for your program. Your if __name__ == "__main__": can be composed of the following: Input the number of rounds as an integer. Input the seed as an integer. Set the seed. Call start_round. def start_round (dice_num) The function to play the game should be called: (DO NOT CHANGE) A function to get the number of each type of dice rolled. Functions to detect whether you have a three of a kind, four of a kind, yahtzee, small or large straight, etc. Functions to handle counting the scores of the roll. If the user wants to count the 1's, 2's, 3's, 4's, 5's, or 6's, sum the input "sum 1", "sum 2", "sum 3".(DO NOT SUM THE SAME THING TWICE) In a typical turn of this game, a players take rolls five dice, and then has two opportunities to reroll any dice that are desired, and then those dice are evaluated according to the options above. USE A LOOP TO RUN THE NUMBER OF ROUNDS THE USER WANTS TO PLAY. For example: if the user enters ‘5’ YOUR CODE SHOULD RUN EXACTLY 5 TIMES. To keep the assignment size manageable, the basic assignment will not need to represent the entire game. It will simply roll five dice and evaluate them, and then allow the player to roll another new set of five dice, and evaluate those. It will need to keep the scores before and after the roll. (THE FIRST ONE SHOULD START WITH 0) Here are some sample results from the instructor's solution. For readability, I put the upper and lower portions side by side.

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter17: Markov Chains
Section: Chapter Questions
Problem 12RP
icon
Related questions
Question

Assignment Description

This program will simulate part of the game of Yahtzee!

This is a dice game that involves rolling five dice and scoring points based on what show up on those five dice. The players would record their scores on a score card, and then total them up, and the player with the larger total wins the game.

A Yahtzee score card has two portions:

The upper portion has spaces for six scores, obtained by adding up all of the 1's, 2's, 3's, etc.

The lower portion has special scores for various combinations:

Three of a kind -- at least 3 dice are the same number;
the score is the sum of all five dice

Four of a kind -- at least 4 dice are the same number;
the score is the sum of all five dice

Small straight -- four consecutive numbers are represented, e.g. 2345;
the score is 25 points

Large straight -- five consecutive numbers are represented, e.g. 23456;
the score is 30 points

Full House -- three of one kind, two of another; the score is 30 points

Yahtzee! -- five of a kind; the score is 50 points

Chance -- nothing special; the score is the sum of all five dice

 

Function of the Homework.

 

  1. This function should be the entry point for your program.  Your if __name__ == "__main__":  can be composed of the following:

Input the number of rounds as an integer.  

Input the seed as an integer.

Set the seed.

Call start_round. def start_round (dice_num)

  1. The function to play the game should be called: (DO NOT CHANGE)

A function to get the number of each type of dice rolled.

Functions to detect whether you have a three of a kind, four of a kind, yahtzee, small or large straight, etc.  

Functions to handle counting the scores of the roll.

If the user wants to count the 1's, 2's, 3's, 4's, 5's, or 6's, sum the input "sum 1", "sum 2", "sum 3".(DO NOT SUM THE SAME THING TWICE)

           

In a typical turn of this game, a players take rolls five dice, and then has two opportunities to reroll any dice that are desired, and then those dice are evaluated according to the options above.

 

USE A LOOP TO RUN THE NUMBER OF ROUNDS THE USER WANTS TO PLAY.

For example: if the user enters ‘5’ YOUR CODE SHOULD RUN EXACTLY 5 TIMES.

To keep the assignment size manageable, the basic assignment will not need to represent the entire game. It will simply roll five dice and evaluate them, and then allow the player to roll another new set of five dice, and evaluate those. It will need to keep the scores before and after the roll. (THE FIRST ONE SHOULD START WITH 0)

 

 

Here are some sample results from the instructor's solution.
For readability, I put the upper and lower portions side by side.

 

What is the number of rounds that you want to play? 3
Your Score is: 0
Rolled: 6 6 4 44
How would you like to sum this dice roll? three of a kind
Three of a Kind
24
Sets of l's: 0 Four of a Kind 0
0.
Sets of 2's: 0 Full House
0.
Sets of 3's: 0 Small Straight 0
Sets of 4's: 3 Large Straight
Sets of 5's: 0 Yahtzee
Sets of 6's: 2 Chance
Transcribed Image Text:What is the number of rounds that you want to play? 3 Your Score is: 0 Rolled: 6 6 4 44 How would you like to sum this dice roll? three of a kind Three of a Kind 24 Sets of l's: 0 Four of a Kind 0 0. Sets of 2's: 0 Full House 0. Sets of 3's: 0 Small Straight 0 Sets of 4's: 3 Large Straight Sets of 5's: 0 Yahtzee Sets of 6's: 2 Chance
Your Score is: 28
उ
Rolled: 13425
How would you like to sum this dice roll? sum 2
You summed this before
Try again: sum 3
Summing all the 3 s
3.
Three of a Kind 0
Sets of l's: 1 Four of a Kind
Sets of 2's: 1 Full House.
0.
Sets of 3's 1 Small Straight
Sets of 4's: 1 Large Straight
Sets of 5's: 1 Yahtzee
0.
Sets of 6's 0 Chance
0.
Good job, your final score was 31!
Transcribed Image Text:Your Score is: 28 उ Rolled: 13425 How would you like to sum this dice roll? sum 2 You summed this before Try again: sum 3 Summing all the 3 s 3. Three of a Kind 0 Sets of l's: 1 Four of a Kind Sets of 2's: 1 Full House. 0. Sets of 3's 1 Small Straight Sets of 4's: 1 Large Straight Sets of 5's: 1 Yahtzee 0. Sets of 6's 0 Chance 0. Good job, your final score was 31!
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Array
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole