Conditional Gambler's Ruin I've learned about the most canonical gambler's ruin problems, but what if winning or losing on a previous turn changes the probability of winning or losing on the following turn?  Say each turn I either win or lose.  Every turn after winning, I win with probability p, and every turn after losing, I win with probability q.  How would I compute the long term proportion of turns won.  Say I want to approximate the number of turns I won after n turns.

You can study this using a Markov chain with two states (1=post-win, 2 = post-loss), and transition matrix
$$ \pmatrix{ p & 1-p\cr q & 1-q\cr}$$
The equilibrium probabilities are $q/(q+1-p)$ and $(1-p)/(q+1-p)$.  The long term proportion of wins is then $q/(q+1-p)$.
