Markov chain application Gambler's Ruin Problem Could anyone please explain me why you must assume to be win at i+1 and lose at i-1 in order to get to the highlighted lines?
Thanks a lot.
.
 A: A player $A$ plays a sequence of independent games against an opponent $B$. At each game either the player wins say \$1 with probability $p$ or loses \$1 with probability $q=1-p$. We assume that player $A$ initially has an amount of \$k and his opponent $B$ has \$(N-k). That is, the total amount in the game is \$N, and no inflow or outflow of money is allowed. The game continues until either of the players get ruined. If $X_{n}$ denotes the accumulated amount with the player $A$ after $n$ games, then the sequence $\{X_{0},X_{1},X_{2},\cdots,\}$ represents a time homogeneous finite state Markov chain with the state space $S=\{0,1,2,3,\cdots,N\}$. The states, $0$ and $N$ being absorbing states. We are interested in computing the probability that player $A$ wins all the amount in the game. Let  $P_{k}$ denote the  probability that player $A$ wins all the amount in the game, given that he has an initial capital of \$k.
\begin{equation*}
P_{k}=P\{X_{n}=N, \mbox{ for some n }\vert X_{0}=k\}
\end{equation*}
To compute the above probability, we observe that either he wins the first game, with  probability $p$, and go on to win all the amount starting with capital \$(k+1), OR, he lose the first game, with  probability $q=1-p$ and 
 go on to win all the amount starting with capital \$(k-1). This give the difference equation,
 \begin{equation*}
 P_{k}=pP_{k+1}+qP_{k-1}, \quad 0<k<N.
 \end{equation*}
