The Dice game of threes

2k Views Asked by At

I am looking for what the probability of a certain roll for the game of threes. The rules for the game:

Start with five dice, roll all of them, and you must take away at least one die from the pile; that is your score. If you roll a three it counts as a zero in the summation of the total score and the lowest score wins. After you roll the original five dice and have removed at least one, you can choose to reroll the rest, and this process continues until the last die.

For example, rolling the following: 2, 3, 3, 1, 4 is a score of 7 as threes are counts as zeros. Also if I roll 3, 6, 6, 6, 6, I can keep the 3 and reroll the four 6 results in an attempt to get a lower score. In this example the next roll could have 4, 1, 2, 2 and I would have to take at least one away so I would take the 1, for a score of zero(3) + 1, and then reroll the remaining three dice.

SO I could luck out and with rerolls ("with replacement" I guess) and get a score of zero. And preferably I would want to get the lowest possible score.

How would find the probability of rolling a particular score, and what would the maths look like to to find how many threes I could have rolled in a round. For example how would I find the probability of something like rolling: one 3 in the first round (3,x,x,x,x) and then two threes in the second round (3,3,x,x) and then a two in the third round (2,x) and a one the last roll (4), thus ending the game with a score of 6. (obviously x does knot equal 3).

1

There are 1 best solutions below

1
On

Similar question. We'll assume you want to minimize the mean total.

Rolling strategy

At each stage, you would never set aside a higher die over a lower die. Therefore we can iterate over the dice from lowest to highest; the cost of setting aside $k$ dice is concave up. However, as we shall see, the cost of the remaining dice is concave down, so we do have to consider all $n$ possibilities. Fortunately, with only five dice at most this is not difficult for a computer.

Inductive solution

From here, we can compute the solution using linear memoization.

  • Base case: Playing with 0 dice always produces 0 total and 0 threes.
  • Inductive case: Consider all possible sorted rolls of a pool of $n$ dice, following the strategy above. The expected cost of keeping the lowest $k$ dice is the sum of those dice plus the expected cost of playing the game with $n - k$ dice, which we already computed in a previous iteration. Then we can just pick the choice of $k$ that minimizes the expected cost.

Example script

Here's a script using my Icepool Python package. You can run it in your browser using this JupyterLite notebook.

import icepool

# Maps pool size -> outcome distribution.
# Start with base case: 0 total, 0 threes.
results = [icepool.Die([(0, 0)])]

die = icepool.Die([(1, 0), (2, 0), (0, 1), (4, 0), (5, 0), (6, 0)])

def play_game(*sorted_rolls):
    n = len(sorted_rolls)
    total, threes = 0, 0
    best_score = None
    best_result = None
    for k, (number, is_three) in enumerate(sorted_rolls, start=1):
        total += number
        threes += is_three
        this_score = results[n - k].marginals[0].mean() + total
        if best_score is None or this_score < best_score:
            best_score = this_score
            best_result = results[n - k] + (total, threes)
    return best_result

for n in range(1, 6):
    results.append(icepool.apply_sorted(play_game, *([die] * n)))

Result

5 dice:

Mean cost: 6.254

Die with denominator 470184984576

Cost # of threes Quantity Probability
0 5 4857964416 1.033203%
1 4 17130860640 3.643430%
2 3 24270850800 5.161979%
2 4 11886939648 2.528141%
3 2 17264039760 3.671755%
3 3 31451837112 6.689247%
4 1 6402643920 1.361729%
4 2 32357171088 6.881796%
4 3 11295770760 2.402410%
4 4 4855121328 1.032598%
5 0 1136558736 0.241726%
5 1 15825265272 3.365753%
5 2 21804171300 4.637360%
5 3 12501846372 2.658921%
5 4 3684437328 0.783614%
6 0 3486487968 0.741514%
6 1 14059484280 2.990203%
6 2 16819672806 3.577246%
6 3 16329758676 3.473050%
6 4 2959925808 0.629524%
7 0 4022076060 0.855424%
7 1 11107798428 2.362432%
7 2 21443508675 4.560654%
7 3 12093836892 2.572144%
8 0 3544540986 0.753861%
8 1 13098252972 2.785766%
8 2 19112011038 4.064785%
8 3 5211871352 1.108473%
9 0 3917243445 0.833128%
9 1 13126469007 2.791767%
9 2 10606448091 2.255803%
9 3 2871863624 0.610794%
10 0 4290841653 0.912586%
10 1 9088214808 1.932902%
10 2 7716929901 1.641254%
10 3 2913391152 0.619627%
11 0 3504199949 0.745281%
11 1 6998644551 1.488487%
11 2 6668324823 1.418234%
11 3 1116281008 0.237413%
12 0 2900516924 0.616888%
12 1 6150726597 1.308150%
12 2 4330261121 0.920970%
12 3 248527288 0.052857%
13 0 2665509741 0.566907%
13 1 4545850111 0.966822%
13 2 1952508774 0.415264%
14 0 2194178801 0.466663%
14 1 2735274829 0.581744%
14 2 1097510584 0.233421%
15 0 1561377808 0.332077%
15 1 1695236438 0.360547%
15 2 541084423 0.115079%
16 0 1074613686 0.228551%
16 1 1038702230 0.220914%
16 2 193715268 0.041200%
17 0 730400168 0.155343%
17 1 496126281 0.105517%
17 2 35080199 0.007461%
18 0 426339453 0.090675%
18 1 205932430 0.043798%
18 2 2968203 0.000631%
19 0 219969304 0.046784%
19 1 81086831 0.017246%
20 0 110100009 0.023416%
20 1 29591761 0.006294%
21 0 50181352 0.010673%
21 1 7583622 0.001613%
22 0 19600367 0.004169%
22 1 1201780 0.000256%
23 0 6682778 0.001421%
23 1 101542 0.000022%
24 0 2153193 0.000458%
24 1 3588 0.000001%
25 0 593060 0.000126%
26 0 120184 0.000026%
27 0 16054 0.000003%
28 0 1303 0.000000%
29 0 57 0.000000%
30 0 1 0.000000%