Archive for balanced random walk

triple ruin

Posted in Books, Kids, pictures, R, Statistics, Wines with tags , , , , , , , , , , on December 28, 2021 by xi'an

An almost straightforward riddle from The Riddler involving a triple gambler’s ruin: Dawn competes against three players Alessandra, Berenike, and Chinue, with probabilities of winning one round ¾, ½, and ¼, respectively, until the cumulated score reaches ±15, ±30, and ±45, for the first, second, and third games. What is Dawn’s optimal sequence of adversaries?

First, a brute force R simulation shows that the optimal ordering is to play the three adversaries first weakest, third strongest and middle fair:

ord=function(p){
  z=2*(runif(1)<p[1])-1
  while(abs(z)<15)z=z+2*(runif(1)<p[1])-1
  y=2*(runif(1)<p[2])-1
  while(abs(z+y)<30)y=y+2*(runif(1)<p[2])-1
  x=2*(runif(1)<p[3])-1
  while(abs(z+y+x)<45)x=x+2*(runif(1)<p[3])-1 
  return(x+y+z>0)}
mcord=function(p,T=1e2){
  for(t in 1:T)F=F+ord(p)
  return(F/T)}
comp=function(T=1e2){
  return(c(mcord(c(.5,.55,.45),t),
    #mcord(c(.5,.45,.55),t),#1-above
    mcord(c(.55,.5,.45),t),
    #mcord(c(.45,.5,.55),t),#1-above
    mcord(c(.55,.45,.5),t)
    #mcord(c(.45,.55,.5),t)))#1-above
    ))}

where I used probabilities closer to ½ to avoid estimated probabilities equal to one.

> comp(1e3)
[1] 0.051 0.038 0.183

(and I eliminated the three other probabilities by sheer symmetry). Second, checking in Feller’s bible (Vol. 1, XIV.3) for the gambler’s ruin probability, a simple comparison of the six orderings confirms this simulation.

%d bloggers like this: