Two players, A and B, start a game with i and N-i chips, respectively. The game consists of repeatedly flipping a fair coin with A receiving 1 chip from B if heads turns up and B receiving 1 from A otherwise. The game ends as soon as one of the two players runs out of chips. If this game is played many times, what is the average duration (length) E(N,i) of a game? Compute an explicit formula for E(N,i) and provide a detailed derivation.
The average length of the game will depend on the total number of chips and on how many chips each player has, hence the indicated dependence on (N,i).
A start: Since $N$ is fixed, it is not particularly useful to mention it. Let $a_i=E(N,i)$. For most $i$, we have the recurrence $$a_{i}=1+\frac{1}{2}(a_{i-1}+a_{i+1}).$$ But for example $a_1=1+\frac{1}{2}a_2$.