Going to a casino is probably quite an easy way to lose money. In the long term. Let’s say that you are following the strategy – always double when you lose and you bet on numbers above 18 on the roulette. If you guess correctly, your bet is doubled. If you missed, you are doubling your bet to cover your losses.
I have decided to simulate the chances of a person, going on a casino with 10,000 money (as in the games, we do not call them dollars or euro, but money) and betting 1 million times uf he has money left. The question is – can this poor fellow win after all? He is doubling all the time and thus “covering” his losses. The answer is pretty sad – out of 10000 times going to a casino, the fellow dude won 68 times. This is definitely not a lot and not impressive.
Was he not lucky? Nope, it is pure statistics. If we change the rules of the game a bit, and we consider that the person is betting on numbers above 18 on the roulette, but whenever a 0 comes out he wins as well, then this is the result of one simulation:
The “poor” fellow won only in 11% of the cases, although he was in a better position than the casino… Unbelievable! Any ideas why? Probably the answer is in the “greed”, which is replicated by the number of spins that we do with the roulette – 1 million. If we reduce these to 1000, then the results are quite different – our guy destroys the casino:
And this is quite expected, because the odds are in his favour and he is not too greedy – he spins only 1000 times.
This is the code, I have used for the simulations:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
using System; class Startup { static void Main() { Random rnd = new Random(); int timesWon = 0; int timesTried = 10000; Console.WriteLine(SimulateCasino(10000,rnd)); Console.WriteLine(SimulateCasino(10000,rnd)); Console.WriteLine(SimulateCasino(10000,rnd)); for (int i = 0; i < timesTried; i++) { if (SimulateCasino(10000, rnd) == "Won!") { timesWon++; } } Console.WriteLine("Tries: {0}", timesTried); Console.WriteLine("Times won: {0}", timesWon); } private static string SimulateCasino(int currentMoney, Random rnd) { int timesToBet = 0; int currentBet = 1; while (currentMoney > 0 && timesToBet < 10000) { if (rnd.Next(0, 37) > 18) { currentMoney += currentBet * 2; currentBet = 1; } else { currentBet = currentBet * 2; if (currentBet > currentMoney) { currentBet = currentMoney; } currentMoney -= currentBet; } timesToBet++; } string result = currentMoney > 0 ? "Won!" : timesToBet + " " + currentMoney; return result; } } |
These are the two conditions, that I was changing in the article:
1 2 |
while (currentMoney > 0 && timesToBet < 10000) if (rnd.Next(0, 37) > 18) |
The first is how many times the person bets, if he still has money in his pocket and the second is when the person wins – in this case he wins only if the random number is from 19 to 36, he loses on 0 to 18.
Cheers & Enjoy!