In the second book of the Lone Wolf series of game books, there happens to be a chapter describing a gambling game.

The game rules goes like:

  • the player bets an (integer) amount of money
  • the player chooses a number between 0 and 9
  • a random number is rolled, between 0 and 9 (equiprobably), with the following effects:
    • if the player guessed correctly, he wins 8 times his wager
    • if the number the player picked was just before or after the roll (0 and 9 are adjacent for this purpose), he wins 5 times his wager

This is obviously a good game to play, as the expected gain is 1.1 times the wager. However, if the player goes broke, he loses.

Now, given a starting capital of $n$ coins, and a target of $t$ coins:

  • is, as I suspect, the best strategy to only ever bet a single coin to reduce the probability of losing?
  • what is the probability of reaching the target when playing with the optimal strategy?
  • EDIT : and what's the distribution of the gains once the target is reached?

EDIT: as the best course of action seems to bet a coin at a time, it is possible to write a transition matrix. Then I suppose one could compute its limit when repeatedly squared, and have the answer. However, is there a nicer closed-form equation?

EDIT2: I wrote a transition matrix approximation (documented here), but I am still looking for a nice symbolic solution, if at all possible.


Let $w$ be your wager. The expected outcome is $(1/9)8w+(2/9)5w=(18/9)w=2w$ and this is twice the expected wager. This gamble is favorable to the player as you point out. There is a general theory (originating with Dubins and Savage) about the optimal way to play favorable/unfavorable repeated gambles. In a nutshell, the theory shows that your intuition is correct and (assuming no deadline and no time discounting) it is best to play cautiously and place the minimum bet each time. Playing works to your advantage, as far as your capital does not get wiped out by some (unlikely but possible) string of bad luck.

  • $\begingroup$ There are 10 numbers between 0 and 9, not 9 ;) Thanks for the strategy confirmation! $\endgroup$
    – bartavelle
    Mar 18 '17 at 14:59
  • $\begingroup$ @bartavelle: oops, of course you are right. The argument holds anyway. $\endgroup$
    – mlc
    Mar 18 '17 at 15:23
  • $\begingroup$ Minor quibble: If the target $t$ is less than your starting capital $n$ (i.e., if your goal is to lose some of your money), then your best bet is to wager $n-t$, not $1$. $\endgroup$ Nov 24 '17 at 11:44

Is there a limit on how many times you can play? If not, playing the minimum stake gives you the least chance of going broke and if you don't you will eventually reach your goal. If there is a limit on how many times you can play you may need to wager more to have any chance of reaching $t$. Ignoring the quantization of coins and minimum bet, the result is usually that you should play a fixed percentage of your bankroll at any point. You will then never run out of money. You can compute the probability of meeting $t$ as a function of the fraction of your bankroll that you bet, then maximize over the fraction. Another nice feature of betting a fixed fraction is the result only depends on the number of wins and losses, not on the order they occur.

In your example, if you bet a fraction $w$ of your bankroll, hit the exact number $H$ times, hit the neighboring number $N$ times, and lose $L$ times you have $(1-w)^L(1+5w)^N(1+8w)^H$ times your original bankroll at the end. If we assume perfectly average luck we can maximize $(1-w)^7(1+5w)^2(1+8w)$ and find it is about $2.19581$ at $w\approx 0.18015$ If your target increase is larger than this in ten rolls you will have to be lucky, while if your target is smaller you can stand some bad luck.

  • $\begingroup$ The quantization of coins and minimum bet are an integral part of the problem ... $\endgroup$
    – bartavelle
    Mar 18 '17 at 18:28

I might have missed something, but if the wager is $w$ then I think that the expected outcome is :
$0.1\times (8w)+0.2\times (5w)+0.7\times (-w)=1.1w$.
Moreover there are stopping conditions in the original game.

EDIT : The system is a Markov chain with two absorbing states.
Let $t$ be your target.
You should write the difference between the identity matrix and the transient part of the transition matrix.
This difference is a dimension $(t-1)$ matrix $T$.
Each line is a function of the number of coins at step $s$ and each column is a function of the number of coins at step $(s+1)$.

$$ T = \begin{matrix} 1 & 0 & 0 & 0 & 0 & -0.2 & 0 & 0 & -0.1 & 0 & \cdots & 0 \\ -0.7 & 1 & 0 & 0 & 0 & 0 & -0.2 & 0 & 0 & -0.1 & 0 & \cdots \\ 0 & -0.7 & 1 & 0 & 0 & 0 & 0 & -0.2 & 0 & 0 & -0.1 & 0 \\ \vdots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots \\ \vdots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots \\ \vdots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots \\ \vdots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots \\ \vdots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots \\ \vdots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots \\ \vdots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots \\ \vdots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots & \ddots \\ 0 & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots & 0 & -0.7 & 1 \\ \end{matrix} $$

Also write the result vector $R_t$ as below.
Its dimension is also $(t-1)$ and each line $l$ is the probability of reaching the target at step $(s+1)$ if you have $l$ coins at step $s$.

$$ R_t = \begin{pmatrix} 0 \\ \vdots \\ \vdots \\ 0 \\ 0.1 \\ 0.1 \\ 0.1 \\ 0.3 \\ 0.3 \\ 0.3 \\ 0.3 \\ 0.3 \\ \end{pmatrix} $$

The probability of reaching the target if you start with $n$ coins is given at line $n$ of vector $P_t$ with: $P_t=T^{-1}R_t$.
Thus invert the matrix $T$ and calculate the product of this inverse with the vector $R_t$.

EDIT2 : Probability distribution:
Using similar calculations, you can also calculate the probability of reaching the other absorbing state.
Since this state is $0$, the corresponding result vector $R_0$ is a dimension $(t-1)$ column vector with $0.7$ on the first line, and $0$ anywhere else.
You will then find that $P_t+P_0=1$ for each line.
Thus the probability of being at any intermediate state is $0$ for the stationnary distribution, whatever is the amount of coins you start with.
The reason is that you have no limit of time and then, after an infinite number of steps if necessary, the probability of being absorbed on one side or another is $1$.

  • $\begingroup$ Oh you are right about the expectation! $\endgroup$
    – bartavelle
    Nov 6 '17 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.