Books · The Fiddler: Solutions
Chapter 89
Can You Even the Odds?
You (player ) and a friend (player ) take turns rolling a die, and the first to roll a wins. Plain alternation favours . To even things out, you use the snake order, reversing within each pair of turns: . With this order, what is the probability that wins?
The Fiddler, Zach Wissner-Gross, July 26, 2024(original post)
Solution
Number the rolls ; roll is the first with probability , and whoever owns that roll wins. So ’s win probability is , summed over the rolls takes. The snake order hands the rolls , the positions and . Summing those two geometric series, so wins with probability Plain alternation gives the odd rolls and probability , 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 lands there: the sum collapses to .
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: . What is ’s win probability?
Solution
The Thue–Morse order gives roll (counting from ) to exactly when has an even number of s in binary. With that bit-count, the win probability uses the classic product identity : The Thue–Morse order is famous as the fairest simple alternation rule, and it pulls ’s advantage down to about a sixth of a percent, far below the snake’s .
The computation
Sum the first- probability over the rolls the Thue–Morse rule gives (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...