This month's Challenge Question: Specs & Techs from GlobalSpec:
Two
players alternately roll an N-sided die. The only rule of the game is
the player who does not improve from the previous roll loses. Player A starts
rolling, followed by player B, and they continue rolling alternately. What is
the probability that player A wins?
And the answer is:
Let's assume that a roll of r has just occurred. Now, let's determine the probability that the player who goes next loses. Let's call this probability Lr. The probability that this player wins is 1 - Lr. To win this player must roll a number a greater than r. The probability that a or r occurs is 1/N. Then the probablity of winning, given that the player must beat a roll of r, is:

Now, let's write the above equation using r - 1 instead of r,

Now subtract this equation from the previous one,

This equation is applicable for all r from 1 to N. Using LN = 1 we get

To determine the probability that the first player loses, we may assume that r = 0 has just occurred. Then, the probability that the first player wins is

|
Comments rated to be Good Answers:
Comments rated to be "almost" Good Answers: