Bitcoin Forum

Other => Beginners & Help => Topic started by: c0inbuster on February 06, 2013, 06:21:36 PM



Title: Satoshi Dice - need some explanations
Post by: c0inbuster on February 06, 2013, 06:21:36 PM
Hello,

I need some explanations about Satoshi Dice betting game.

I did a little Python script (with Numpy and Pandas) in order to test differents "strategies"
(I know it 's a negative expected value game so I don't expect a lot from this ;-) ).

see
http://pastebin.com/sMikS4xG

but I don't know what I should do with "house_percent" variable.

I think I did a mistake here :
Code:
self.df['BalanceVar'] = np.where(self.df['TossResults']>0, self.df['Size']*price_multiplier, -self.df['Size'])

but I don't know how this variable (house_percent) should intervene.

Kind regards


Title: Re: Satoshi Dice - need some explanations
Post by: wtfvanity on February 06, 2013, 06:24:45 PM
Why did you post the same thing twice?

https://bitcointalk.org/index.php?topic=141588.msg1508155#msg1508155


Title: Re: Satoshi Dice - need some explanations
Post by: c0inbuster on February 06, 2013, 07:34:04 PM
Because I did a mistake and when I click to alert moderator the forum says that I had to wait 360 seconds ! and after waiting I get this message
An Error Has Occurred!
You can't report your own post to the moderator, that doesn't make sense!


Title: Re: Satoshi Dice - need some explanations
Post by: wtfvanity on February 06, 2013, 07:37:42 PM
Because I did a mistake and when I click to alert moderator the forum says that I had to wait 360 seconds !

You can edit your post. They look identical just different subjects.

If you're just looking for the edge that the house maintains, they post that on their site http://satoshidice.com/

It is 1.9% with the exception of less than 1 which is 1.844, which no one has ever won.


Title: Re: Satoshi Dice - need some explanations
Post by: c0inbuster on February 06, 2013, 07:57:28 PM
In fact my problem is mathematics...

Let's have a look at "less than 8000".

win odds = 8000/65535 = 12.2%
(and lose odds = 87.8%)

According to website multiplier is 8 and house percent is 1.9%

Let's imagine that I'm paying 0.1BTC for this game.

Expected value is :
0.1 * 8 * 12.2 + (-0.1) * 87.8

The problem with this formula is that I get a positive expected value
> 0.1*8*12.2/100-0.1*87.8/100
0.0098

I should get a negative value !


Title: Re: Satoshi Dice - need some explanations
Post by: Envite on February 06, 2013, 11:50:13 PM
Why negative?

Your expected income needs to be positive. Your earnings will be negative (that's what you get if you do 0.01-0.0098)


Title: Re: Satoshi Dice - need some explanations
Post by: c0inbuster on February 07, 2013, 05:14:58 AM
Expected income IS negative
it MUST BE negative
otherwise the casino always ends up close !
that's why there is a "house_percent"


Title: Re: Satoshi Dice - need some explanations
Post by: DannyHamilton on February 07, 2013, 06:01:14 AM
Expected income IS negative
it MUST BE negative
otherwise the casino always ends up close !
that's why there is a "house_percent"

I'm not yet sure where my mistake is, but there has to be something wrong with my math. Here's whay I came up with looking at "lessthan 8000":

Play 0.01 BTC 65536 times.  Assume that each possible value comes up once.
Total bets = 65,536 * 0.01 BTC = 655.36 BTC in bets placed.
8,000 wins = 8,000 * 8 * 0.01 = 640 BTC in winnings
655.36 BTC - 640 BTC = 15.36 BTC in profits for "the house"

8,000 wins / 65,536 plays = 12.2070% Win Odds
Satoshi Dice advertises 12.2070% Win Odds, so this looks good

15.36 BTC / 655.36 BTC = house edge of 2.34%
Satoshi Dice advertises 1.9% House Percent, this is where I must be making a mistake.  My calculated house edge seems higher than the actual house edge.


Title: Re: Satoshi Dice - need some explanations
Post by: deepceleron on February 07, 2013, 07:45:15 AM
Expected income IS negative
it MUST BE negative
otherwise the casino always ends up close !
that's why there is a "house_percent"

I'm not yet sure where my mistake is...

Satoshidice pays out losers too, and you pay the transaction fee back to yourself:

1. If you lose, your bet is returned times 0.005 (0.5% for losers)
2. On a win or a lose a transaction fee of 0.0005 is subtracted from the payment amount. If this makes the payment amount zero or less the payment is set to 0.00000001.

https://bitcointalk.org/index.php?topic=80312.msg1022610#msg1022610


Title: Re: Satoshi Dice - need some explanations
Post by: DannyHamilton on February 07, 2013, 08:18:45 AM
. . . Satoshidice pays out losers too . . .

1. If you lose, your bet is returned times 0.005 (0.5% for losers) . . .
Ah ha! I hadn't realized that they ever paid more than 0.00000001 on a loser.  Now the math works out.

Play 1 BTC 65536 times.  Assume that each possible value comes up once.
Total bets = 65,536 * 1 BTC = 65,536 BTC in bets placed.
8,000 wins = 8,000 * 8 * 1 = 64,000 BTC returned on winning bets
57,536 losses = 57,536 * 0.005 * 1 = 287.68 BTC returned on losing bets
65,536 BTC received - (64,000 BTC + 287.68 BTC) paid = 1,248.32 BTC in profits for "the house"

8,000 wins / 65,536 plays = 12.2070% Win Odds
Satoshi Dice advertises 12.2070% Win Odds, so this looks good

1248.32 BTC / 65,536 BTC = house edge of 1.9048%
Satoshi Dice advertises 1.9% House Percent, so this looks good too.


Title: Re: Satoshi Dice - need some explanations
Post by: c0inbuster on February 07, 2013, 12:24:27 PM
Thanks a lot for your explanations.
I will try to improve my script to reflect that.

I would like to try to make some martingale experiments (I know that it is a desperate and suicidal strategy
that's just for fun ;-) )
I would also like to try cautious technics such as Kelly criterion.

Anyway winner is always the casino ;-)


Title: Re: Satoshi Dice - need some explanations
Post by: c0inbuster on February 07, 2013, 01:09:54 PM
I think I'm still wrong

see
http://pastebin.com/pyDB3wiN

I changed
Code:
self.df['BalanceVar'] = np.where(self.df['TossResults']>0, self.df['Size']*price_multiplier, -self.df['Size'])
for
Code:
self.df['BalanceVar'] = np.where(self.df['TossResults']>0, self.df['Size']*price_multiplier, -self.df['Size']+0.005 * self.df['Size'])
But I don't understand why... but after 60000 tosses I always win (around 60BTC) !

I probably did a mistake... but I don't know what mistake I did !!!

Any help is welcome (you will need Python 2.7, Numpy and Pandas)


Title: Re: Satoshi Dice - need some explanations
Post by: c0inbuster on February 07, 2013, 02:02:05 PM
In fact the problem is here
Code:
self.df['BalanceVar'] = np.where(self.df['TossResults']>0, self.df['Size']*price_multiplier, -self.df['Size']+0.005 * self.df['Size'])

I should be :
Code:
self.df['BalanceVar'] = np.where(self.df['TossResults']>0, self.df['Size']*(price_multiplier-1), -self.df['Size']+0.005 * self.df['Size'])

Because if you bet 1BTC and win you will earn 8 BTC (price_multiplier*size)
but you ever spend 1BTC so balance variation is 7 BTC !!!

That's why there is a price_multiplier-1

I tried it with very big tosses number 65536*500=32'768'000 and calculated experimental house_percent
and it was very close from 1.9%

so that's ok !

Code is here http://pastebin.com/LvCU1gag