High School

We appreciate your visit to Program Poker Dice Game Program Specifications Write a program to calculate the score from a throw of five dice Scores are assigned to different categories. This page offers clear insights and highlights the essential aspects of the topic. Our goal is to provide a helpful and engaging learning experience. Explore the content and find the answers you need!

Program: Poker Dice Game

**Program 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 provided main code.

- 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:** Complete 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.
- Submit for grading to confirm two tests pass.

**Example:**
```
If input is: 2 4 1 5 4
The output is: High score: 8
```

---

**Step 2:** Complete the `check_three_of_kind()`, `check_four_of_kind()`, and `check_five_of_kind()` functions.

- Hint: Since the values are in ascending order, 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.
- Submit for grading to confirm five tests pass.

**Example:**
```
If input is: 2 4 4 5 4
The output is: High score: 30
```

---

**Step 3:** Complete the `check_full_house()` function.

- 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.
- Submit for grading to confirm seven tests pass.

---

**Step 4:** Complete the `check_straight()` function.

- 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.

**Example:**
```
If input is: 4 6 2 5 4
The output is: High score: 30
```

Answer :

Final answer:

The task involves creating a program to score a poker dice game. The program will include functions to check for singles, three/five of a kind, a full house, and straights in the roll of the dice. It incrementally adds functionality and tests its accuracy at each step.

Explanation:

This task involves creating a poker dice game scoring program. The requirements extend from setting up the basic structure of the game, where values of the roll of five dice are input into a list, to developing several functions: check_singles() that returns the sum of all values that match a parameter goal, check_three_of_kind() and check_five_of_kind() that verify if certain conditions are met to assign points, and then check_full_house() and check_straight() that operate on similar principles. Each step has a specific development task and a testing phase, gradually building up the program's functionality.

Each roll's potential score is calculated based on different poker hand categories such as singles, three of a kind, four/five of a kind, full house, and straight. The program must be able to correctly determine which category's score should be applied based on the dice results. It's essential to understand that dice are fair and six-sided, and the outcomes are equally likely, which is a principle aspect of the game's probability.

Learn more about Poker Dice Game Program Creation here:

https://brainly.com/question/31608314

#SPJ11

Thanks for taking the time to read Program Poker Dice Game Program Specifications Write a program to calculate the score from a throw of five dice Scores are assigned to different categories. We hope the insights shared have been valuable and enhanced your understanding of the topic. Don�t hesitate to browse our website for more informative and engaging content!

Rewritten by : Barada