Probability question with die roll (gambling) Let $a, b$ be two integers such that $1 \leq a \leq 7$ and $2\leq b\leq5$.  We play the following game:
We start with $a$ euros and we roll a die.  If the result of the die is at least $b$, we earn $1$ euro and we lose $1$ euro otherwise.
The game ends if we reach $8$ euros (winners) or in $0$ (losers).
We prefer to be?
A) Rich: we start with $a = 6$ euros , but unlucky because $b=5$.
B) Mediocre: we start with $a=4$ and $b=4$
C) Lucky: we start with $a=2$ but $b=3$.
 A: You are essentially asking for what the limit is of
$$
M^nI
$$
As $n$ grows large, where $I$ is a (column) vector of all $0$s except a single entry set to $1$ indicating where we start (i.e., the value of $a$); I'm using the convention that the initial vector with a $1$ at the top entry means that you start broke, and a $1$ at the bottom means that you start with 8 euros. $M$ is the matrix:
$$
  \left( 
   {\begin{array}{ccccccccc}
   1 & 1-p & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
   0 & 0 & 1-p & 0 & 0 & 0 & 0 & 0 & 0 \\
   0 & p & 0 & 1-p & 0 & 0 & 0 & 0 & 0 \\
   0 & 0 & p & 0 & 1-p & 0 & 0 & 0 & 0 \\
   0 & 0 & 0 & p & 0 & 1-p & 0 & 0 & 0 \\
   0 & 0 & 0 & 0 & p & 0 & 1-p & 0 & 0 \\
   0 & 0 & 0 & 0 & 0 & p & 0 & 1-p & 0 \\
   0 & 0 & 0 & 0 & 0 & 0 & p & 0 & 0 \\
   0 & 0 & 0 & 0 & 0 & 0 & 0 & p & 1 \\
  \end{array} } \right)
$$
Where $p$ is the probability of going up a euro when you play the game. (so, 1/3 in scenario A, 1/2 in scenario B and 2/3 in scenario C)
The way to find out what happens to matrix powers is generally to diagonalize the matrix; diagonalizing this matrix in its general form is very difficult, but for specific values we can just ask Wolfram Alpha:
This matrix diagonalized for $p=\frac{2}{3}$
This matrix diagonalized for $p=\frac{1}{2}$
Now we're able to read the probabilities off the diagonalization. Find the rows of the matrix $J$ that just have a single $1$ in them. Those same rows in the matrix $S^{-1}$ will tell you the probabilities. From this we discover that in scenario B there is a $0.5$ chance of winning, in scenario C there is a chance of $0.752941$ of winning, and scenario A can be handled by noting that winning in scenario A is the same chance as losing in scenario C, so with with A there is $0.247059$ chance of winning.
So the best choice is scenario C
In fact, you could have made choices A and C more extreme: start out with seven euros in A and only one euro in C and you're still just barely more likely to win in scenario C.

Here is a short program using python and the numpy library that does the same computation:
import numpy as np
from numpy import linalg as LA

def game_mat(p):
    return np.matrix(
        [[1,1-p,0,0,0,0,0,0,0],
         [0,0,1-p,0,0,0,0,0,0],
         [0,p,0,1-p,0,0,0,0,0],
         [0,0,p,0,1-p,0,0,0,0],
         [0,0,0,p,0,1-p,0,0,0],
         [0,0,0,0,p,0,1-p,0,0],
         [0,0,0,0,0,p,0,1-p,0],
         [0,0,0,0,0,0,p,0,0],
         [0,0,0,0,0,0,0,p,1]],
        dtype=np.double
    )

vals, vecs = LA.eig(game_mat(2/3))
print(list(np.round(vecs * np.array(np.diag(vals) > 0.99999) * vecs**(-1), 6)[-1]))

The last line there prints out the probability of winning given each possible starting amount from 0 euros to 8 euros. The number passed to the game_mat function is the probability of going up each time you play.
In general, you can apply this approach to any game in which you have some small set of states that you can transition to probabilistically. Just make the element in the initial matrix in row $r$ and column $c$ the probability that, given that you're in state $c$ you'll jump to state $r$ next.
