## D’Alembertian Betting System

The D’Alembertian betting system is an idea which seeks to enable you to make a profit betting on an even-money game by adjusting your stake in successive bets according to the outcome of the previous bet. I will be investigating the application of this system particularly in regard to betting on red or black at roulette which is a (nearly) even money outcome.

## Doubling up System

I will first mention the doubling up system, because the purpose of the D’Alembertian system is to improve on this approach.

The doubling up system is very simple. You place a stake of 1 unit (say on red) for your first bet. If you lose you bet 2 units (again on either red or black, it makes no difference). If you lose again you place 4 units. Every time you lose you double your previous stake.

Eventually you will win, and your net profit for the whole series of bets will be 1 unit

Eg If your first 4 bets are losses and the 5th wins your totals will be.

```
Total losses = 1 + 2 + 4 + 8 = 15
Win = 16 ```

Net result, a win of 1 unit. This will always be the result however long the series.

The problem with the doubling up system is that the required stake can get very big. If you have a run of 10 losses in a row you will be betting 1024 units on the next turn (and you will have already lost a total of 1023 units). So if you get a run of bad luck you need a huge float of money relative to the amount you are trying to win. Most of the time you will win,, but when you lose, you will lose badly. Depending on how much you are trying to win with each series (may be more than 1 unit) you may run up against the house limit.

## The D’Alembertian System

The idea of the D’Alembertian system is to try to avoid the situation of having to place the large bets that sometimes happen in the doubling up system. You start by writing down a series of numbers (it does not really matter what the numbers are, but your winnings at the end of a series will be the sum of these numbers).

`1 1 2 3 3`

The total of the above numbers is 10, so at the end of the series you will have won 10 units. There is no particular restriction on the number of entries in the series, you could equally well have started with

`5 5`

I will use the 1 1 2 3 3 example in this discussion. Each bet you make should be the sum of the first and last number in your series. So in this case, your first bet will be 1 + 3 = 4 units.

Let’s suppose you were unsuccessful. You write down the value of the bet you have just made at the end of your series which now looks like this.

`1 1 2 3 3 4`

Your next bet will be 5 units (the sum of the first and last number in your list). Notice that you have only increased from a bet of 4 to a bet of 5. You are not doubling up. Let’s say you win this bet. You can now cross off the 2 numbers that you added together to form the bet – ie the first and last number on the list. Your list of numbers now looks like this

`1 2 3 3`

And so it continues. The beauty of this system is that every time you lose a bet you are adding 1 number to the list, but every time you win you are crossing off 2 numbers. Since you are betting on even money outcomes, you will certainly eventually complete the series.

It all sounds too good to be true. I therefore decided to investigate further by running a simulation.

## The Program

I wrote a program to simulate what happens if you follow this system. The program allows you to specify your float ie (the initial amount of money you have to gamble with) and your target amount to end up with. You can also specify the list of numbers you wish to use to apply the system.

The program will then run 50000 iterations according to your specifications, and you will be able to see how you have got on. It will apply the algorithm until the target amount is reached, or alternatively until there is not enough money left to place the required bet. For those that are interested the simulation program is shown below. Please note that to satisfy the formatting requirements of the wiki I have had to use &lt; in place of < and &gt; instead of > in various places. If you edit the page to take a copy of the code you will need to do a global replace to revert this in the resulting source code.

```
#include <stdio.h>
#include <sys/time.h>

static int bet[10000] ;
static int series = 0 ;
static int seriesCount = 0 ;
static int lowbet = 0;
static int highbet = 0;
static int thisbet = 0;
static int numBets = 0 ;
static int total = 0 ;
static int target = 0 ;
static int maxbet = 0 ;
static int runningTotal = 0 ;
static int totalSav = 0 ;
static int totalBets = 0 ;
static int numSuccess = 0 ;
static int numFails = 0 ;
static int runningLoss = 0 ;

#define NUM_SERIES 50000

nextSeries(int argc, char **argv)
{
runningTotal += (total - totalSav);
totalBets += numBets ;

//printf ("Running total %d\n", runningTotal) ;

total = atoi (argv[1]) ;
target = atoi (argv[2]) ;
series++ ;
maxbet = 0 ;
numBets = 0 ;
}

resetbets(int argc, char **argv)
{
int i ;
for (i=0;i<10000;i++)
{
bet[i] = 0 ;
}

for (i=3; i < argc; i++)
{
bet[i-3] = atoi (argv[i]) ;
}

lowbet = 0;
highbet = argc - 4 ;
}

main (int argc, char **argv)
{
int     winfactor ;
int     maxhighbet = 0 ;

if (argc < 4)
{
printf ("Usage: dalamb <wallet> <target> <first> <second> <third> ...\n") ;
printf ("eg dalamb 1000 1100 2 2 2 2\n") ;
exit (0) ;
}

// init totals
totalSav = atoi (argv[1]) ;
total = totalSav ;
runningTotal = totalSav ;

// init random seed
struct timeval tp ;
gettimeofday (&tp, NULL) ;

srandom (tp.tv_usec) ;

// init series and bets
nextSeries(argc, argv) ;
resetbets(argc, argv) ;

while (1)
{
if (series > NUM_SERIES)
break ;

numBets++ ;

if (lowbet == highbet)
thisbet = bet[lowbet] ;
else
thisbet = bet[lowbet] + bet[highbet] ;

if (thisbet > total)
{
/*
printf ("Failed: Series %d, Total %d, maxBet %d, numBets %d ThisBet %d ",
series, total, maxbet, numBets, thisbet) ;
*/

runningLoss += (totalSav - total) ;
numFails++ ;
nextSeries(argc, argv) ;
resetbets(argc, argv) ;
continue ;
}

if (thisbet > maxbet)
maxbet = thisbet ;

winfactor = random() % 100000 ;
if (winfactor <= 48649)
//if (winfactor <= 51351)
{
total += thisbet ;
lowbet++ ;
highbet--;
if (lowbet > highbet)
resetbets(argc, argv) ;
}
else
{
total -= thisbet ;
highbet++ ;
bet[highbet] = thisbet ;
}

if (total >= target)
{
/*
printf ("Success: Series %d, Total %d, maxBet %d, numBets %d ",
series, total, maxbet, numBets) ;
*/

numSuccess++ ;
nextSeries(argc, argv) ;
resetbets(argc, argv) ;
}
}

double seriesSuccess = numSuccess / (double) NUM_SERIES * 100.0 ;
double seriesFail = numFails / (double) NUM_SERIES * 100.0 ;
double avBets = totalBets / (double) NUM_SERIES ;
double avTimeSeries = avBets * 45.0 / 60 ;
double avGain = (runningTotal - totalSav) / (double) NUM_SERIES ;
double avGainBet = (runningTotal - totalSav) / (double) totalBets ;
double avLoss = runningLoss / (double) numFails ;

printf ("\n") ;
//printf ("Current Balance              %d\n", runningTotal) ;
//printf ("Num Target Success           %d\n", numSuccess) ;
//printf ("Num Target Fail          %d\n", numFails) ;

printf ("Target success percentage      %f\n",seriesSuccess);
printf ("Target fail percentage             %f\n",seriesFail);
printf ("Average loss per Target failure    %f\n",avLoss);
printf ("Average bets per Target attempt        %f\n",avBets);
printf ("Average gain per Target attempt        %f\n",avGain);
printf ("Average gain per bet           %f\n",avGainBet);

if (avTimeSeries < 60.0)
printf ("Average time per Target attempt        %f minutes\n",avTimeSeries);
else
printf ("Average time per Target attempt        %f hours\n",avTimeSeries / 60.0);
} ```

## Results

Let’s try running the simulation. Assume you have £200 to gamble with and you want to win £50. We will choose a series 1 3 3 3 for this first simulation. This means we will need to complete 5 series to reach our target.

```% ./dalamb 200 250 1 3 3 3
Target success percentage               71.778000
Target fail percentage                  28.222000
Average loss per Target failure         169.055489
Average bets per Target attempt         36.401820
Average gain per Target attempt         -11.821840
Average gain per bet                    -0.324760
Average time per Target attempt         27.301365 minutes
[1]    17233 exit 51    ./dalamb 200 250 1 3 3 3```

The results are to say the least disappointing. 71.78% percent of the time we achieve our goal of winning £50 (to make our total £250), but this means that 28.22% of the time we do not succeed, and on those occasions the average loss is £169, Ouch.

We also see that it takes us on average 36.4 bets to complete the process (win or lose) and given the assumption that there are 45 seconds between spins of the roulette wheel, this has taken (on average) 27.3 minutes.

But it is the 2 negative numbers above that show how things have gone wrong. On average, every time we take a trip to the casino and apply these spending patterns it costs us £11.82 at a rate of about 32 pence per bet placed.

So let’s try something slightly different. Let’s keep the starting amount and target the same, but this time setup the starting sequence such that we only need to complete only 1 series

```% ./dalamb 200 250 10 20 20
Target success percentage               74.542000
Target fail percentage                  25.458000
Average loss per Target failure         164.797706
Average bets per Target attempt         4.577460
Average gain per Target attempt         -4.683200
Average gain per bet                    -1.023100
Average time per Target attempt         3.433095 minutes
[1]    17249 exit 50    ./dalamb 200 250 10 20 20```

This is a bit better, but we are still losing money (albeit at about half the rate). The main difference is that we have spent a very short evening at the roulette table (average less than 4 mins)

So let’s keep to a single series and make the length of the series longer

```% ./dalamb 200 250 2 2 2 3 3 3 4 4 4 5 5 6 7
Current Balance                         -519507
Target success percentage               72.776000
Target fail percentage                  27.224000
Average loss per Target failure         171.841537
Average bets per Target attempt         22.481140
Average gain per Target attempt         -10.394140
Average gain per bet                    -0.462349
Average time per Target attempt         16.860855 minutes
[1]    17271 exit 51    ./dalamb 200 250 2 2 2 3 3 3 4 4 4 5 5 6 7```

This is better than the first attempt but worse than the second. Maybe a very short series is best – let’s try it

```% ./dalamb 200 250 50
Current Balance                         -140600
Target success percentage               73.592000
Target fail percentage                  26.408000
Average loss per Target failure         150.000000
Average bets per Target attempt         1.779520
Average gain per Target attempt         -2.816000
Average gain per bet                    -1.582449
Average time per Target attempt         1.334640 minutes ```

This has reduced our average loss (when we do lose) but overall the negative numbers show we are still losing money.

OK. Let’s try something different. Let’s assume we have £2000 to play with (wow!) and we only want to win £20

```% ./dalamb 2000 2020 10 10
Current Balance                         -429110
Target success percentage               98.354000
Target fail percentage                  1.646000
Average loss per Target failure         1718.894289
Average bets per Target attempt         4.649680
Average gain per Target attempt         -8.622200
Average gain per bet                    -1.854364
Average time per Target attempt         3.487260 minutes
[1]    17273 exit 50    ./dalamb 2000 2020 10 10```

So we will win our £20 on 98.35% of occasions. The problem is that on the few occasions we do lose, we lose big time – an amount of £1718.89 on average.

Sadly I have to report that irrespective of what initial conditions I put into this tool, I am unable to get a positive result out of it. We always end up losing money, and so I have to declare the system a failure.

## Final Comment

```       winfactor = random() % 100000 ;
if (winfactor <= 48649)
//if (winfactor <= 51351)
```
These lines relate to the fact that betting on red (or black) at roulette is not in fact an even money proposition. There are 18 winning outcomes but 19 losing outcomes (because of the presence of the 0 on the roulette wheel). This is known as the house advantage.

So your real chance of winning is in fact 18/37 which is 48649/100000 (explaining this line in the code). Let’s just pretend for a moment that the house advantage is handed to you instead. To do this we move the commented line as follows

```       winfactor = random() % 100000 ;
//if (winfactor <= 48649)
if (winfactor <= 51351)```

This means that for our simulation now, it is effectively as though if the result of the spin matches our chosen colour OR the result is 0 then we win. Our odds of winning any single bet are now 19/37. We have the house advantrage. Let’s try any of our simulations.

```% ./dalamb 200 250 1 3 3 3
Current Balance                         511010
Target success percentage               81.736000
Target fail percentage                  18.264000
Average loss per Target failure         167.826325
Average bets per Target attempt         34.265480
Average gain per Target attempt         10.216200
Average gain per bet                    0.298148
Average time per Target attempt         25.699110 minutes```

Look at this – all the numbers are positive. True we have an 18.26% chance of losing an average of £167.83, but on the average we will win £10.22 every time we try this. Suffice it to say that I have tried many different sets of initial conditions with the house advantage set in my favour, and the results are always positive.

So it seems that it is the house edge that make the difference here. This system, clever though it seems, is not in the long run providing any benefit at all, and you will succumb to the house advantage in just the same way as you would if you were betting a constant amount on every occasion.

If you can find a game to bet on where the house advantage is in your favour then go for it, using this system. I wish you good luck finding such a game…