Skip to content
Vamshi Jandhyala

Books · The Fiddler: Solutions

Chapter 89

Can You Even the Odds?

You (player AA) and a friend (player BB) take turns rolling a die, and the first to roll a 55 wins. Plain alternation ABABABAB\,AB\,AB\dots favours AA. To even things out, you use the snake order, reversing within each pair of turns: ABBAABBAAB\,BA\,AB\,BA\dots. With this order, what is the probability that AA wins?

The Fiddler, Zach Wissner-Gross, July 26, 2024(original post)

Solution

Number the rolls 1,2,3,1,2,3,\dots ; roll kk is the first 55 with probability (56)k116\bigl(\tfrac56\bigr)^{k-1}\tfrac16, and whoever owns that roll wins. So AA’s win probability is 16kA(56)k1\tfrac16\sum_{k\in A}\bigl(\tfrac56\bigr)^{k-1}, summed over the rolls AA takes. The snake order ABBAABBAAB\,BA\,AB\,BA hands AA the rolls 1,4,5,8,9,1,4,5,8,9,\dots, the positions 4m+14m+1 and 4m+44m+4. Summing those two geometric series, P(A)=16[1+(5/6)31(5/6)4]=16341/216671/1296=341671=3161,P(A)=\frac16\left[\frac{1+(5/6)^3}{1-(5/6)^4}\right]=\frac16\cdot\frac{341/216}{671/1296}=\frac{341}{671}=\frac{31}{61}, so AA wins with probability 316150.82%.\boxed{\tfrac{31}{61}}\approx50.82\%. Plain alternation gives AA the odd rolls and probability 61154.5%\tfrac{6}{11}\approx54.5\%, so the snake nearly halves the first-mover edge.

The computation

Assign each roll to its player under the snake rule and add up the chance the first 55 lands there: the sum collapses to 3161\tfrac{31}{61}.

from fractions import Fraction as F
q, p = F(5, 6), F(1, 6)
def turn(k):                                       # 0-indexed roll -> player, snake order
    rnd, pos = k // 2, k % 2
    return ('A', 'B')[pos] if rnd % 2 == 0 else ('B', 'A')[pos]
PA = p * sum(q ** k for k in range(4000) if turn(k) == 'A')
print(PA.limit_denominator(1000))                  # 31/61

Extra Credit

Now take turns by the Thue–Morse sequence, complementing the whole history each round: ABBABAABBAABABBAA\,B\,BA\,BAAB\,BAABABBA\dots. What is AA’s win probability?

Solution

The Thue–Morse order gives roll kk (counting from 00) to AA exactly when kk has an even number of 11s in binary. With s(k)s(k) that bit-count, the win probability uses the classic product identity k(1)s(k)qk=j0(1q2j)\sum_k(-1)^{s(k)}q^k=\prod_{j\ge0}\bigl(1-q^{2^j}\bigr): P(A)=12+112j0(1(56)2j)0.5016.P(A)=\frac12+\frac{1}{12}\prod_{j\ge0}\left(1-\left(\tfrac56\right)^{2^{\,j}}\right)\approx \boxed{0.5016.} The Thue–Morse order is famous as the fairest simple alternation rule, and it pulls AA’s advantage down to about a sixth of a percent, far below the snake’s 0.8%0.8\%.

The computation

Sum the first-55 probability over the rolls the Thue–Morse rule gives AA (those with an even binary digit-sum); it lands just above one half.

PA_tm = p * sum(q ** k for k in range(4000) if bin(k).count('1') % 2 == 0)
print(float(PA_tm))                                # 0.50159...