Draft

Dice Game Strategy - "Five Thousand"

Description:

Description

Implement a function to decide whether to roll again in a simplified version of the dice game "Five Thousand" aka "Ten Grand"

The game is also known by the names "Greed" and "Zonk" — for more kata (by other authors) related to this game, click those links.

In this game, players roll dice to accumulate points, aiming to be the first to reach 5,000 points. For the purposes of this simple kata, points are scored for...

  • single ones
  • single fives
  • three of a kind

with players risking their current turn's points with each additional roll. Your task is to write a function that helps a player decide whether to risk rolling again based on their current probability of scoring and their personal risk threshold.

Task

Write a function called roll_again(dice_num: int, prob_thresh: float) -> bool that decides whether a player should roll the dice again. This decision is based on the number of dice left to roll, and the player's risk threshold.

Parameters

  • dice_num (int): The number of dice being considered for re-roll. It represents how many dice you currently have in play.
  • prob_thresh (float): A probability threshold (between 0 and 1, inclusive) that determines the minimum probability of scoring required to consider rolling the dice again beneficial. This threshold is your risk tolerance for the decision.
  • Assume all input will be valid
    • 1 <= dice_num <= 10
    • 0 <= prob_thresh <= 1

Return

The function returns True if the calculated probability of scoring is greater than the prob_thresh; otherwise, returns False. This boolean value advises whether rolling the dice again under the given conditions is statistically advantageous.

Scoring

  • Single ones (1) are worth 100 points each.
  • Single fives (5) are worth 50 points each.
  • Three of a kind are worth 100 times the number rolled, except for three ones which are worth 1000 points. These must be rolled in the same roll.
  • All other combinations have no value.
Games

Stats:

CreatedFeb 4, 2024
Warriors Trained14
Total Skips0
Total Code Submissions52
Total Times Completed10
Python Completions10
Total Stars1
% of votes with a positive feedback rating67% of 3
Total "Very Satisfied" Votes1
Total "Somewhat Satisfied" Votes2
Total "Not Satisfied" Votes0
Total Rank Assessments4
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • JezzaHehn Avatar
Ad