Heyo, Steemians!
And today I'm gonna show you how casino works from the mathematical point of view.
Suppose that on every dollar bet you can win your bet multiplied on some_magic_constant with 50% probability:
Obviously, constant should be > 1 or it is not interesting (you obviously loose in money every time).
Okay, we are "honest" casino and make this multiplier equal to 1.99!
And now you win 1.99 dollar from 1 dollar bet with 50% probability.
Is it tempting for you? ;-) Ready to gamble?
Wait!
Indeed, let's count expected value of your deposit after every game (suppose you have a dollar before)
So, if you 're a gambling person and repeat you game many times (thats how expected value works), you will always inevitable loose.
Well, after all that you can say:
You choice! Let's check this out in practise!
I write a code especially for you:
#include
#include
#include
int main(void)
{
int TEST_AMOUNT = 100000;
double sum = 0;
double magic = 1.99; //magic constant
srand(time(NULL));
for(int i = 0; i < TEST_AMOUNT; ++i)
{
double deposit = 1.0;
double bet = 0.1;
while(deposit - bet > 0) //while we can make a bet
{
deposit -= bet;
int dice = rand();
if(dice % 2){
deposit += bet * magic;
break; // strategy?
}
else
bet *= 2; // strategy?
}
sum += deposit;
}
printf("Average: %lf\n", sum/TEST_AMOUNT);
}
It's easy to understand: we have some deposit here and start bet size.
We make many tests, throw a random dice with 50% prob. and try to gamble in clever way.
Every time you loose you raise the bet.
However that doesn't help and average deposit size after game is less than starting deposit.
It's not allowed to change:
It's allowed to change:
If you found it - post here in comments.
P.S. if you really-really found it write me secret e-mail :-)
Image source:
https://www.bellagio.com
Thank you for your attention! Follow my blog @ideamaker for more.