# Expected number of steps in Gambler's ruin game with two players

Let's say we have two players A and B. Player A has 3 coins and player B has 5 coins. If player wins the other player gives one coin. During game second player probability of loosing is $$2/3$$, while player A has chances of loosing 1/3. How to find expected number of steps (either outcome player A or B lose/win). Another condition is that players agrees to play maximum of 7 games.

Here is my attempt. My transition matrix

Q = $$\begin{bmatrix} 0 & \frac{1}{3} & 0 & 0 & 0 & 0 & 0 \\ \frac{2}{3} & 0 & \frac{1}{3} & 0 & 0 & 0 & 0 \\ 0 & \frac{2}{3} & 0 & \frac{1}{3} & 0 & 0 & 0 \\ 0 & 0 & \frac{2}{3} & 0 & \frac{1}{3} & 0 & 0 \\ 0 & 0 & 0 & \frac{2}{3} & 0 & \frac{1}{3} & 0 \\ 0 & 0 & 0 & 0 & \frac{2}{3} & 0 & \frac{1}{3} \\ 0 & 0 & 0 & 0 & 0 & \frac{2}{3} & 0 \end{bmatrix}$$

$$N = (I-Q)^{-1}$$

$$t = N1 = \begin{bmatrix} \frac{247}{85} & \frac{486}{85} & \frac{709}{85} & \frac{180}{17} & \frac{1027}{85} & \frac{1026}{85} & \frac{769}{85} \end{bmatrix}$$

But I am not sure if the answer is $$\frac{1027}{85}$$ since the players agree to play only 7 games maximum.