Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Poker Dice GameProgram Specifications Write a program to calculate the score from a throw of five dice. Scores are assigned to different categories for singles

Poker Dice GameProgram Specifications Write a program to calculate the score from a throw of five dice. Scores are assigned to different categories for singles, three of a kind, four of a kind, five of a kind, full house, and straight. Follow each step to gradually complete all functions.Note: This program is designed for incremental development. Complete each step and submit for grading before starting the next step. Only a portion of tests pass after each step but confirm progress.Step 0. Review the poker game step document. Five integer values are input and inserted into a list. The list is sorted and passed to find_high_score() to determine the highest scoring category. Make no changes to the main code. Stubs are provided for all remaining functions.Step 1. Write the check_singles() function. Return the sum of all values that match parameter goal. Update the find_high_score() function to use a loop to call check_singles() six times with parameters being 1-6. Return the highest score from all function calls. Test it and move to next step.Ex: If input is:24154the output is:High score: 8 Step 2. Write the check_three_of_kind(), check_four_of_kind(), and check_five_of_kind() functions. Hint: Since the values are in ascending order, the same values are stored in consecutive index locations. Return 30 from check_three_of_kind() if the dice contain at least three of the same values. Ex: (2,3,3,3,6). Return 40 from check_four_of_kind() if the dice contain at least four of the same values. Ex: (4,4,4,4,5). Return 50 from check_five_of_kind() if the dice contain five identical values. Ex: (5,5,5,5,5). Update the find_high_score() function to call the three functions and return the highest score from all function calls. Test it and move to the next step.Ex: If input is:24454the output is:High score: 30Step 3. Write the check_full_house() function to return 35 if the dice contain a full house (a pair and three of a kind). Ex: (1,1,3,3,3). Note: Five of a kind also satisfies the definition of a full house since (4,4,4,4,4) includes a pair of 4s and three 4s. Update the find_high_score() function to call check_full_house() and return the highest score from all function calls. Test and move to next.Step 4. Write the check_straight() function to return 45 if the dice contain a straight of (1,2,3,4,5) or (2,3,4,5,6). Update the find_high_score() function to call check_straight() and return the highest score from all function calls. Submit for grading to confirm all tests pass. PYTHON

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions