4
$\begingroup$

There are $L$ levels in a game. In each turn of the game, you go through each level one by one and try to complete it. The goal is to complete all levels of the game. The probability of completing any one of the $L$ levels in a single turn is $p$. If you complete a particular level at a previous turn then that progress is saved and you don't have to complete it in any successive turns. Even if you fail to complete any level at a particular turn, then the turn continues with the other levels(you don't go to a new turn). So in each turn, you try all the $L$ levels. On average, how many turns do you have to play the game to complete all the levels?

This was my approach. Let $N_k$ be the average number of turns you need to play the game in order to complete any $k$ of those $L$ levels($0\le$ $k$ $\le$ $L$). I write the following recurrence relation(from which I can easily calculate $N_L$, the desired answer, since $N_0=0$).

$(N_k+1)[1-(1-p)^{L-k}]+(N_{k+1}+1)(1-p)^{L-k}=N_{k+1}$

This is because if you win any one of the remaining $L-k$ levels in the next turn, you have taken $N_k+1$ turns to complete $k+1$ levels and if you lose all, you need $N_{k+1}+1$ turns to complete $k+1$ levels. Is this recurrence correct? Is there any loophole in my logic?

$\endgroup$
5
  • $\begingroup$ Not sure I understand. The probability of completing all $L$ levels on a single turn is $p^L$? So it's just a Bernoulli process with success probability $p^L$? If so, the answer is just $\frac 1{p^L}$. $\endgroup$
    – lulu
    Apr 27, 2016 at 0:33
  • $\begingroup$ @lulu No, you have misunderstood. You don't have to complete all the levels in a single turn. " If you complete a particular level at a previous turn then that progress is saved and you don't have to complete it in any successive turns". So the successive turns are not independent. $\endgroup$ Apr 27, 2016 at 1:01
  • $\begingroup$ Got it. This question, which is your problem for $p=.5$, has a couple of good solutions (easily adapted for general $p$). $\endgroup$
    – lulu
    Apr 27, 2016 at 2:14
  • $\begingroup$ Suppose on the first turn I succeed upto level 3, fail at level 4, succeed at level 5, fail all other levels. In the next turn, do I only have to attempt level 4, and level 6 onwards ? $\endgroup$ Apr 27, 2016 at 3:50
  • $\begingroup$ Well, effectively yes! We can try all other levels if we like, but since we have already completed them beforehand, we wouldn't care whether we complete them or not, in any successive turn. So you can think that we have to complete only the incomplete levels each turn. $\endgroup$ Apr 27, 2016 at 4:02

3 Answers 3

3
$\begingroup$

You recurrence relation may be correct, but here is a different perspective.

The number of tries required to complete one level, is independent of all the other levels, and is distributed in some manner you can figure out (probability $p$ to finish in one try, $(1-p)p$ in a second try, you can see the distribution coming out of this).

Introduce $L$ new random variables, say $R_1, ... , R_L$,where each $R_i$ is an independent identically distributed variable, which stores the number of tries required to finish the $i$th level.

Now the total number of tries you will need is $R_1 + ... + R_L$, and the expectation value $E[R_1 + ... + R_L] = \sum E[R_i]$, can you figure out $E[R_i]$ now with the distribution you have got for $R_i$? This method is much easier than evaluating a recurrence relation, especially of the kind you have put out.

EDIT: Your question seems to have changed, then I will refer you to the answer below, which is the same a the one I am getting.

$\endgroup$
2
  • $\begingroup$ In each turn it's able to complete more than one level. So would the expected value equal to the sum of expected values of completing each level? Since the expected number of turns required to complete each level is $1/p$ this would mean that the desired result is $L/p$. This seems wrong. $\endgroup$ Apr 27, 2016 at 11:00
  • $\begingroup$ I have not read the rephrasing of our question. Please wait for an edited answer so that I can tackle your question. $\endgroup$ May 2, 2016 at 5:17
1
$\begingroup$

Consider this formulation of your problem: When you play a level, you have two options: win the level with probability $p$ (and ascend to the next level) or die with probability $1-p$ (and spend another turn). Consider the following question: How many times do you die on average before you win $L$ times?

Clearly this number is $L$ times the number of times you die on average before you win one level, since beating each level takes the same effort on average. If you win with probability $p$, then you'll expect to win the first time after $1/p$ tries (the expected value of the geometric distribution), which means you'll have died $1/p-1$ times on average. So to beat the entire game, you'll have to repeat this process $L$ times, the number of deaths will be $L/p-L$ in total, and the number of turns you need is therefore $L/p-L+1$.

$\endgroup$
1
  • $\begingroup$ You don't go to a new turn if you fail any level. You try to complete all the levels each time. I have updated the problem statement. Sorry for the ambiguity. $\endgroup$ Apr 27, 2016 at 0:21
1
$\begingroup$

Let $q = 1-p$

We can view the process as a "group knockout" tournament of $L$ players,
where only $1$ out of each group of $q$ makes it to the next round until we get the "winner"

Working backwards, in the finals, we must have $q$ players, in the semi-finals, $q^2$ players and so on.

Thus if $n$ rounds are needed, $q^n = L,\;\; or\;\; n = \frac {L}{log\;\; q}$

But here we need to "knock out" the winner also (complete the last level), which needs an additional $\frac{1}{p}$ "ghost matches" !

Thus answer $ = \frac {L}{log\;\; q} + \frac{1}{p}$

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .