# Ruin time with a maximum purse size

Imagine I have a gambler's ruin scenario where I start with $m$ dollars and I cannot have more than $N$ dollars. For each of however many rounds, I flip a coin, and with probability $p$ I win a dollar, and with probability $(1-p)$ I lose a dollar. If I win a dollar when I already have $m=N$ dollars, I simply do not lose a dollar.

What is my ruin time (i.e. the time to reach $m=0$)? Can we calculate a variance for the ruin time?

I'm sure this must be a classic result, but I cannot find the example in books such as (Parzen 1962), or Feller...

-
This is an example of a standard problem for Markov Chains. Both the variance and the average ruin time can be found as solutions of certain linear equations. For the average time check out the first chapter of the book "Markov Chain" by Norris. When you're done with it, you can easily derive the equation for the second moment. –  Ilya Jan 15 '13 at 12:35