Pages:
Author

Topic: Does martingale really works? - page 72. (Read 123303 times)

legendary
Activity: 1358
Merit: 1003
Designer - Developer
March 09, 2015, 06:41:32 PM
You should code it to yolo doog.. As most gamblers roll er into the ground if martingaling.
legendary
Activity: 2940
Merit: 1333
March 09, 2015, 06:32:52 PM
What's your Just-Dice userid?

Thanks, Doog!

user ID: 156525
username: itod

I'll try to martingale from 15 to 30 CLAMs! Wink

I sent the tip.

I made this slight change to the code:

Code:
           if bet > bankroll:     # we can't afford the next bet
                if bankroll > 0:
                    bet = base
                else:
                    break

ie. if we can't afford to continue the sequence, reset to the starting bet unless we're out of coins completely.

After that we're back to the 50% chance of doubling up that I was expecting to see:

Code:
1500151 wins out of 3000000 rounds (50.005%)
0:49.99%, 30:50.01%
expectation: 15.00151
legendary
Activity: 1974
Merit: 1077
^ Will code for Bitcoins
March 09, 2015, 06:02:07 PM
What's your Just-Dice userid?

Thanks, Doog!

user ID: 156525
username: itod

I'll try to martingale from 15 to 30 CLAMs! Wink
legendary
Activity: 2940
Merit: 1333
March 09, 2015, 05:55:43 PM
Found it. The trick is you have left with some money when you can not afford to make a bet

Exactly.

I was thinking that you either double-up or bust, but what mostly happens is that you end up with something left, but not enough to make the next bet.

Updated the simulation to track the amount you have left when you "lose", and to show the average amount you end up with:

Code:
#!/usr/bin/env python

import random, string

start = 15                         # starting bankroll
target = 30                        # target bankroll
base = 1                           # starting bet
rounds = wins = 0
final={}

while True:
    bankroll = start
    bet = base
    rounds += 1

    while True:
        if random.random() < 0.5:  # we won
            bankroll += bet        # award winnings
            bet = base             # reset
            if bankroll >= target: # we reached the target
                wins += 1
                break
        else:                      # we lost
            bankroll -= bet        # subtract loss
            bet *= 2               # double bet
            if bet > bankroll:     # we can't afford the next bet
                break

    if final.has_key(bankroll):
        final[bankroll] += 1
    else:
        final[bankroll] = 1

    if not rounds % 100000:
        sum = 0.0
        for bankroll in final:
            sum += final[bankroll] * bankroll
        print "%6d wins out of %6d rounds (%6.3f%%)" % (wins, rounds, wins * 100.0 / rounds)
        print string.join(map(lambda(bankroll): "%d:%.2f%%" % (bankroll, final[bankroll] * 100.0 / rounds), final), ', ')
        print "expectation: %s" % (sum / rounds)
        print

And its output:

Code:
3041169 wins out of 8000000 rounds (38.015%)
0:6.24%, 1:5.86%, 2:5.49%, 3:5.13%, 4:4.82%, 5:4.54%, 6:4.24%, 7:3.98%, 8:3.73%, 9:3.50%, 10:3.27%, 11:3.06%, 12:2.87%, 13:2.71%, 14:2.54%, 30:38.01%
expectation: 15.008940625

So only 6.24% of the time do you actually bust.
5.86% of the time you end up with 1 unit,
5.49% of the time, 2 units, etc.

You sometimes has as much as 14 units left, but need to bet 15 to continue, and so count it as a loss.

Not that the average amount you end up with is 15 units - the same as you started with.

What's your Just-Dice userid?
legendary
Activity: 1974
Merit: 1077
^ Will code for Bitcoins
March 09, 2015, 05:47:00 PM
Something's wrong. House can't win almost 2/3 of the time if it has 0% edge. It would mean that it is possible for the house to lose 2/3 time with 0% player edge. Something like that would be exploited by now.

You're correct, something's wrong. But what is it?

Something in the code. I'm reviewing it right now, gut feeling is something like the way those variables are incremented inside those while loops. If the code is OK (which I doubt), then we stumbled onto something very interesting.

No, it's not the code. The code is right, in that it does what I intended it to do:

It starts with a balance of 15, and martingales from 1 unit, doubling on loss, resetting on win, and stopping either when the bankroll has doubled, or when it can not afford to make the next bet.

There's a prize of 15 CLAM tipped to your Just-Dice account for the first person to post a correct explanation of how it is possible that your chance of doubling up using that strategy can be less than 50%, and for the casino's expectation to still be zero...

Found it. The trick is you have left with some money when you can not afford to make a bet, which can be accumulated with the similar leftovers from next round. Changed three lines of code to demonstrate it, added 'bankroll_left' variable to accumulate for the unaccounted funds:

Code:
#!/usr/bin/env python

import random

start = 15                         # starting bankroll
target = 30                        # target bankroll
base = 1                           # starting bet
rounds = wins = bankroll = bankroll_left = 0

while True:
    bankroll_left += bankroll      # added what's left of the bankroll to a sum
    bet = base
    rounds += 1

    while True:
        if random.random() < 0.5:  # we won
            bankroll += bet        # award winnings
            bet = base             # reset
            if bankroll >= target: # we reached the target
                wins += 1
                break
        else:                      # we lost
            bankroll -= bet        # subtract loss
            bet *= 2               # double bet
            if bet > bankroll:     # we can't afford the next bet
                break

    if rounds % 100000 == 0:
        print "%6d wins out of %6d rounds (%6.3f%%) with %6d left in total bankroll" % (wins, rounds, wins * 100.0 / rounds, bankroll_left)

And the result:

Code:
37978 wins out of 100000 rounds (37.978%) with 1500673 left in total bankroll
 75740 wins out of 200000 rounds (37.870%) with 2996025 left in total bankroll
113803 wins out of 300000 rounds (37.934%) with 4497196 left in total bankroll
151835 wins out of 400000 rounds (37.959%) with 5997364 left in total bankroll
189945 wins out of 500000 rounds (37.989%) with 7501452 left in total bankroll
newbie
Activity: 31
Merit: 0
March 09, 2015, 05:42:26 PM
Something's wrong. House can't win almost 2/3 of the time if it has 0% edge. It would mean that it is possible for the house to lose 2/3 time with 0% player edge. Something like that would be exploited by now.

You're correct, something's wrong. But what is it?

Something in the code. I'm reviewing it right now, gut feeling is something like the way those variables are incremented inside those while loops. If the code is OK (which I doubt), then we stumbled onto something very interesting.

No, it's not the code. The code is right, in that it does what I intended it to do:

It starts with a balance of 15, and martingales from 1 unit, doubling on loss, resetting on win, and stopping either when the bankroll has doubled, or when it can not afford to make the next bet.

There's a prize of 15 CLAM tipped to your Just-Dice account for the first person to post a correct explanation of how it is possible that your chance of doubling up using that strategy can be less than 50%, and for the casino's expectation to still be zero...

The answer is the site is rigged.
member
Activity: 112
Merit: 10
March 09, 2015, 05:38:50 PM
Something's wrong. House can't win almost 2/3 of the time if it has 0% edge. It would mean that it is possible for the house to lose 2/3 time with 0% player edge. Something like that would be exploited by now.

You're correct, something's wrong. But what is it?

Something in the code. I'm reviewing it right now, gut feeling is something like the way those variables are incremented inside those while loops. If the code is OK (which I doubt), then we stumbled onto something very interesting.

No, it's not the code. The code is right, in that it does what I intended it to do:

It starts with a balance of 15, and martingales from 1 unit, doubling on loss, resetting on win, and stopping either when the bankroll has doubled, or when it can not afford to make the next bet.

There's a prize of 15 CLAM tipped to your Just-Dice account for the first person to post a correct explanation of how it is possible that your chance of doubling up using that strategy can be less than 50%, and for the casino's expectation to still be zero...

Witchcraft.
legendary
Activity: 2338
Merit: 1047
March 09, 2015, 05:38:28 PM
Something's wrong. House can't win almost 2/3 of the time if it has 0% edge. It would mean that it is possible for the house to lose 2/3 time with 0% player edge. Something like that would be exploited by now.

You're correct, something's wrong. But what is it?

Something in the code. I'm reviewing it right now, gut feeling is something like the way those variables are incremented inside those while loops. If the code is OK (which I doubt), then we stumbled onto something very interesting.

No, it's not the code. The code is right, in that it does what I intended it to do:

It starts with a balance of 15, and martingales from 1 unit, doubling on loss, resetting on win, and stopping either when the bankroll has doubled, or when it can not afford to make the next bet.

There's a prize of 15 CLAM tipped to your Just-Dice account for the first person to post a correct explanation of how it is possible that your chance of doubling up using that strategy can be less than 50%, and for the casino's expectation to still be zero...
cuz its 50 but you still got the call of hi or lo?
edit: its 50% at the long therm so 4 steps martingale not enough?
its 50% his and 50% lo but not ordered?
legendary
Activity: 2940
Merit: 1333
March 09, 2015, 05:15:05 PM
Something's wrong. House can't win almost 2/3 of the time if it has 0% edge. It would mean that it is possible for the house to lose 2/3 time with 0% player edge. Something like that would be exploited by now.

You're correct, something's wrong. But what is it?

Something in the code. I'm reviewing it right now, gut feeling is something like the way those variables are incremented inside those while loops. If the code is OK (which I doubt), then we stumbled onto something very interesting.

No, it's not the code. The code is right, in that it does what I intended it to do:

It starts with a balance of 15, and martingales from 1 unit, doubling on loss, resetting on win, and stopping either when the bankroll has doubled, or when it can not afford to make the next bet.

There's a prize of 15 CLAM tipped to your Just-Dice account for the first person to post a correct explanation of how it is possible that your chance of doubling up using that strategy can be less than 50%, and for the casino's expectation to still be zero...
legendary
Activity: 1974
Merit: 1077
^ Will code for Bitcoins
March 09, 2015, 05:09:00 PM
Something's wrong. House can't win almost 2/3 of the time if it has 0% edge. It would mean that it is possible for the house to lose 2/3 time with 0% player edge. Something like that would be exploited by now.

You're correct, something's wrong. But what is it?

Something in the code. I'm reviewing it right now, gut feeling is something like the way those variables are incremented inside those while loops. If the code is OK (which I doubt), then we stumbled onto something very interesting.
legendary
Activity: 2940
Merit: 1333
March 09, 2015, 04:55:52 PM
Something's wrong. House can't win almost 2/3 of the time if it has 0% edge. It would mean that it is possible for the house to lose 2/3 time with 0% player edge. Something like that would be exploited by now.

You're correct, something's wrong. But what is it?
hero member
Activity: 700
Merit: 500
March 09, 2015, 02:54:40 PM
It's a good question!
I think that in some case and with some conditions works!
legendary
Activity: 1974
Merit: 1077
^ Will code for Bitcoins
March 09, 2015, 02:38:50 PM
Honestly house edge doesnt even matter that much, you would lose even with 0% house edge using martingale.

Well, this is interesting.

My gut reaction upon reading that was that you are wrong: with 0% house edge you are equally likely to double-up or bust. Because with a 0% house edge the casino's expected profit is 0 regardless of how you play.

So I wrote another simulation. It simulates a player with 15 chips using martingale, starting with bets of 1, doubling on loss, betting at a 0% edge casino.

To my surprise he doubles up 38% of the time and busts 62% of the time.

Can anyone explain how that could be? Is the casino actually making a decent profit from this 0% edge game? I don't believe it.

Something's wrong. House can't win almost 2/3 of the time if it has 0% edge. It would mean that it is possible for the house to lose 2/3 time with 0% player edge. Something like that would be exploited by now.
legendary
Activity: 2940
Merit: 1333
March 09, 2015, 02:05:11 PM
Honestly house edge doesnt even matter that much, you would lose even with 0% house edge using martingale.

Well, this is interesting.

My gut reaction upon reading that was that you are wrong: with 0% house edge you are equally likely to double-up or bust. Because with a 0% house edge the casino's expected profit is 0 regardless of how you play.

So I wrote another simulation. It simulates a player with 15 chips using martingale, starting with bets of 1, doubling on loss, betting at a 0% edge casino.

To my surprise he doubles up 38% of the time and busts 62% of the time.

Can anyone explain how that could be? Is the casino actually making a decent profit from this 0% edge game? I don't believe it.

Here's the code:

Code:
#!/usr/bin/env python

import random

start = 15                         # starting bankroll
target = 30                        # target bankroll
base = 1                           # starting bet
rounds = wins = 0

while True:
    bankroll = start
    bet = base
    rounds += 1

    while True:
        if random.random() < 0.5:  # we won
            bankroll += bet        # award winnings
            bet = base             # reset
            if bankroll >= target: # we reached the target
                wins += 1
                break
        else:                      # we lost
            bankroll -= bet        # subtract loss
            bet *= 2               # double bet
            if bet > bankroll:     # we can't afford the next bet
                break

    if rounds % 100000 == 0:
        print "%6d wins out of %6d rounds (%6.3f%%)" % (wins, rounds, wins * 100.0 / rounds)

and the output:

Code:
37662 wins out of 100000 rounds (37.662%)
 75430 wins out of 200000 rounds (37.715%)
113539 wins out of 300000 rounds (37.846%)
151692 wins out of 400000 rounds (37.923%)
189569 wins out of 500000 rounds (37.914%)
legendary
Activity: 2940
Merit: 1333
March 09, 2015, 01:29:46 PM
the more and more you play get you closer to that house edge

I agree, the odds are not in our favor but i disagree with the bolded part

No, he's right. It's known as the law of large numbers and it states pretty much exactly the bolded part.

To see the effect happening, you can run a simple script like the following:

Code:
#!/usr/bin/env python

import random

heads = 0
total = 0
target = 10

while True:
    if random.random() < 0.5:
        heads += 1
    total += 1

    if total == target:
        print "%10d %10d %10.7f" % (heads, total, heads * 100.0 / total)
        if target < 1e6:
            target *= 10
        else:
            target += 1e6

It simulates the flipping of a coin over and over, and counts how many 'heads' it got, and shows what percentage of the flips were heads.

I just ran it. It started off like this:

Code:
        3         10 30.0000000
        47        100 47.0000000
       495       1000 49.5000000
      5072      10000 50.7200000
     49937     100000 49.9370000
    500296    1000000 50.0296000

So after the first 10 flips, only 3 (30%) were heads.
After the first 100, 47 (47%) were heads. So it's already closer to the expected 50%.
After a million flips, 500296 heads were seen. That's 296 more than expected, which sounds like a lot, but as a percentage of the number of spins it's small - 50.0296% were heads - even closer to 50%.

I left it running. Currently it's showing:

Code:
217997590  436000000 49.9994472
 218498001  437000000 49.9995426
 218997425  438000000 49.9994121
 219496837  439000000 49.9992795
 219997469  440000000 49.9994248

So it's seen 2531 less heads than expected out of 440 million flips, and the total percentage of heads is 49.9994% - that's now incredibly close to 50%.

That's the effect "the bolded part" was talking about. It's real, it does actually happen, but it happens slower than you might think. You have to play a lot of times before you can be reasonably confident of being close to the expected result.

(still running, and flipping either side of 50%)

Code:
306500072  613000000 50.0000117
 307000013  614000000 50.0000021
 307499772  615000000 49.9999629
 307999875  616000000 49.9999797
 308500345  617000000 50.0000559
 309000869  618000000 50.0001406

If everyone went to a casino, played a little bit made 5$ profit and left and never came back again, casinos would probably start loosing money

everyone already know about this, but the fact is everyone wants more because a profit of $5 isnt really much, they wish to get atleast few hundreds buck, therefore , the more they play, they lose their bankroll abit by a bit

If everyone who went to a casino stopped playing when they were $5 up, it wouldn't change anything about the casino's expected profit as a percentage of the amount wagered. It would reduce the amount wagered, and so reduce the expected profits because of that. But it wouldn't turn their positive expectation into a negative one.

Code:
584029219 1168000000 50.0025016
 584529227 1169000000 50.0025002
 585029676 1170000000 50.0025364
 585529527 1171000000 50.0025215
 586029512 1172000000 50.0025181

Edit: hours later and I realise it's still running. That's why my legs are getting hot!

Code:
10275552688 20551000000 50.0002564
10276051812 20552000000 50.0002521
10276551995 20553000000 50.0002530
10277051831 20554000000 50.0002522
10277551548 20555000000 50.0002508
legendary
Activity: 2940
Merit: 1333
March 09, 2015, 01:13:54 PM
If everyone went to a casino, played a little bit made 5$ profit and left and never came back again, casinos would probably start loosing money but no one is gonna do that

So you're saying if the players all won the casinos would all lose?

Please tell me more about your theory. Smiley
hero member
Activity: 910
Merit: 1000
March 09, 2015, 11:54:01 AM
In my experience in gambling. I am sucked several and more times with the martingale. All profit goes to 0 in a second with unimaginable loses in a row.

I think it can  really make a gambler broken also when there exist 99.99% chances of wining in dice.
So, really there is good to leave martingale play Smiley


Well , none of the site allows you to gamble at 99.99% chance, so how did you manage to test it at that ?

Also, martingale might work for short term if you bet with some balance several times in different sized units.

Oh goody. My favourite thread is back from the dead!

Blame the guy who posted before me. The thread does look it just came back after a long time now.
legendary
Activity: 1456
Merit: 1081
I may write code in exchange for bitcoins.
March 09, 2015, 11:50:38 AM
Funny that this thread got revived after so long dead.  Basically, if anyone really wants to know the deal with martingale, they should read the wikipedia page about it.  It lays out the math and the facts pretty straightforwardly in my opinion.

I mean you can see a lot of strategies on the wikipedia and how they all fall, i dont think martingale is that bad of a strategy its just that strategies dont work

I think that more or less all gambling "strategies" rely on somethink like martingale---lowering or raising your bet based on local probability estimates.  Nevertheless, I think the wikipedia article does the job of showing just why these "strategies" are really based on fallacy.  That doesn't mean that gambling isn't fun though!
hero member
Activity: 1064
Merit: 505
March 09, 2015, 10:39:27 AM
Funny that this thread got revived after so long dead.  Basically, if anyone really wants to know the deal with martingale, they should read the wikipedia page about it.  It lays out the math and the facts pretty straightforwardly in my opinion.

I mean you can see a lot of strategies on the wikipedia and how they all fall, i dont think martingale is that bad of a strategy its just that strategies dont work
legendary
Activity: 1456
Merit: 1081
I may write code in exchange for bitcoins.
March 09, 2015, 10:38:02 AM
Funny that this thread got revived after so long dead.  Basically, if anyone really wants to know the deal with martingale, they should read the wikipedia page about it.  It lays out the math and the facts pretty straightforwardly in my opinion.
Pages:
Jump to: