Gambler’s ruin

Player A starts with k chips and Player B with N − k. Each round: A wins one chip from B with probability p (and loses one with probability q = 1 − p). The game ends when one player has all N chips.

For a fair coin (p = 0.5), the probability A wins is simply proportional to their starting stake:

For a biased coin ():

05101520050100150200stepsA's chips
P(A wins) theory
50.0%
simulated win rate
53.3%
color key
green = A wins · red = A ruined · grey = ongoing
A starts with k=10, B starts with 10. Each step: A gains 1 chip with prob p, loses 1 with prob 1−p. .

What to notice

  • Starting stake dominates. With a fair coin and A starting with 10 of 20 chips, A has a 50% chance. Move A to 5 of 20 chips — A’s chance drops to 25%. Small chip advantages translate linearly to win probability.
  • Even a tiny bias is catastrophic in the long run. Set p = 0.49 (A disadvantaged). As N grows, the formula shows A’s winning probability collapses exponentially — this is why casinos with small house edges reliably win over time.
  • Paths that don’t terminate (grey) have simply not reached either boundary within the step limit. Biased walks terminate faster; fair walks can meander for thousands of steps.

Why this matters

Gambler’s ruin is the canonical model for:

  • Bank solvency — a bank with finite capital facing random losses eventually fails, even with a slight edge.
  • Population genetics — a new gene variant competing against the existing population can drift to extinction even if slightly advantageous.
  • Insurance — an insurer with finite reserves facing random claims must eventually exhaust them without adequate reserves.

The lesson: finite capital + random walk = eventual ruin, unless the drift is strongly positive. Having more chips than your opponent matters as much as the coin itself.