Probability of winning the 2-player combat from Warlords series

48 Views Asked by At

There was an old PC game series Warlords. My question is to determine the chances of winning a combat there.

Two players wage a combat with following rules:

  • They have an unbalanced coin with a known probability of "p".
  • Computer flips the coin to determine who loses one life (player one with probability "p", player two with probability "1-p").
  • Player one starts with X lives.
  • Player two starts with Y lives.
  • Coin is flipped until some player loses all lives. He loses.

What is the probability of winning for one player given X, Y, p?

1

There are 1 best solutions below

1
On BEST ANSWER

Assume player 1 has $X$ lives and loses the coin-toss with probability $p$. Then The probability of him losing the whole game is $$ p^X\sum_{j=0}^{Y-1}(1-p)^j\binom{X+j-1}{j},$$ we can sum over all probabilities that player 1 is losing the whole game and player 2 has lost $j$ lives in total.

The binomial coefficient stands for the number of possible positions of the losses of player 2, assuming player 1 loses the $(Y+j)$th round.