This is an exercise in implementing functions to solve a large…
Question Answered step-by-step This is an exercise in implementing functions to solve a large… This is an exercise in implementing functions to solve a large problem. Some of the function specifications are already dictated by the assignment below, but a student is welcome to define any other functions that might be helpful in solving the problem.There is a starter program file provided with this assignment (in the Functions Module) that predefines the names and interfaces of several functions in a suitable order in the file. A section later in this document will give a road map to that file to explain what will be filled in.Assignment DescriptionThis 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 diceFour of a kind — at least 4 dice are the same number;the score is the sum of all five diceSmall straight — four consecutive numbers are represented, e.g. 2345;the score is 25 pointsLarge straight — five consecutive numbers are represented, e.g. 23456;the score is 30 pointsFull House — three of one kind, two of another; the score is 30 pointsYahtzee! — five of a kind; the score is 50 pointsChance — nothing special; the score is the sum of all five diceIn 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.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 not need to keep score, either.Here are some sample results from the instructor’s solution.For readability, I put the upper and lower portions side by side.Rolled: 6 6 4 4 4 Three of a Kind 24Sets of 1’s: 0 Four of a Kind 0Sets of 2’s: 0 Full House 30Sets of 3’s: 0 Small Straight 0Sets of 4’s: 12 Large Straight 0Sets of 5’s: 0 Yahtzee 0Sets of 6’s: 12 Chance 24Another (y/n)? yRolled: 2 2 6 6 1 Three of a Kind 0Sets of 1’s 1 Four of a Kind 0Sets of 2’s 4 Full House 0Sets of 3’s 0 Small Straight 0Sets of 4’s 0 Large Straight 0Sets of 5’s 0 Yahtzee 0Sets of 6’s 12 Chance 17Another (y/n)? yRolled: 3 5 2 5 4 Three of a Kind 0Sets of 1’s 0 Four of a Kind 0Sets of 2’s 2 Full House 0Sets of 3’s 3 Small Straight 25Sets of 4’s 4 Large Straight 0Sets of 5’s 10 Yahtzee 0Sets of 6’s 0 Chance 19Another (y/n)? n Computer Science Engineering & Technology Python Programming COMP 201 Share QuestionEmailCopy link Comments (0)


