Pages:
Author

Topic: Satoshi Dice - how to last longer - page 2. (Read 21196 times)

newbie
Activity: 56
Merit: 0
September 02, 2012, 04:55:59 AM
#22
Also, it starts getting ugly after 50 bets! I have 3 existing bets I have to resume which are past stage 50 to get my money back  Undecided
newbie
Activity: 56
Merit: 0
September 02, 2012, 04:49:14 AM
#21
I just ran that R script for 8x. Here is the output - is this ok?

> #change these variables to suit
> r<- 8
> p <- 8000/65536
> bets<- 100
> max<- 1
>
> strategy.func(r, bets, max, p)
[1] m = 1.14285714285714  |  init = 0.00924140314804633  |  percentage loss to fees = 0.0468061760111049 %.
>
> allbets.func(r, bets, max, p)
       bet number  bet amount
  [1,]          1    0.010562
  [2,]          2    0.012070
  [3,]          3    0.013795
  [4,]          4    0.015765
  [5,]          5    0.018018
  [6,]          6    0.020592
  [7,]          7    0.023533
  [8,]          8    0.026895
  [9,]          9    0.030737
 [10,]         10    0.035128
 [11,]         11    0.040147
 [12,]         12    0.045882
 [13,]         13    0.052436
 [14,]         14    0.059927
 [15,]         15    0.068488
 [16,]         16    0.078272
 [17,]         17    0.089454
 [18,]         18    0.102233
 [19,]         19    0.116838
 [20,]         20    0.133529
 [21,]         21    0.152605
 [22,]         22    0.174406
 [23,]         23    0.199321
 [24,]         24    0.227795
 [25,]         25    0.260337
 [26,]         26    0.297528
 [27,]         27    0.340033
 [28,]         28    0.388609
 [29,]         29    0.444124
 [30,]         30    0.507570
 [31,]         31    0.580081
 [32,]         32    0.662949
 [33,]         33    0.757656
 [34,]         34    0.865893
 [35,]         35    0.989592
 [36,]         36    1.130962
 [37,]         37    1.292528
 [38,]         38    1.477175
 [39,]         39    1.688200
 [40,]         40    1.929371
 [41,]         41    2.204996
 [42,]         42    2.519995
 [43,]         43    2.879994
 [44,]         44    3.291422
 [45,]         45    3.761625
 [46,]         46    4.299000
 [47,]         47    4.913143
 [48,]         48    5.615021
 [49,]         49    6.417167
 [50,]         50    7.333905
 [51,]         51    8.381605
 [52,]         52    9.578978
 [53,]         53   10.947403
 [54,]         54   12.511318
 [55,]         55   14.298649
 [56,]         56   16.341313
 [57,]         57   18.675786
 [58,]         58   21.343756
 [59,]         59   24.392864
 [60,]         60   27.877558
 [61,]         61   31.860067
 [62,]         62   36.411505
 [63,]         63   41.613148
 [64,]         64   47.557884
 [65,]         65   54.351867
 [66,]         66   62.116420
 [67,]         67   70.990194
 [68,]         68   81.131650
 [69,]         69   92.721886
 [70,]         70  105.967870
 [71,]         71  121.106137
 [72,]         72  138.407014
 [73,]         73  158.179444
 [74,]         74  180.776508
 [75,]         75  206.601723
 [76,]         76  236.116255
 [77,]         77  269.847149
 [78,]         78  308.396741
 [79,]         79  352.453419
 [80,]         80  402.803907
 [81,]         81  460.347323
 [82,]         82  526.111226
 [83,]         83  601.269972
 [84,]         84  687.165683
 [85,]         85  785.332209
 [86,]         86  897.522524
 [87,]         87 1025.740028
 [88,]         88 1172.274317
 [89,]         89 1339.742077
 [90,]         90 1531.133802
 [91,]         91 1749.867203
 [92,]         92 1999.848232
 [93,]         93 2285.540836
 [94,]         94 2612.046670
 [95,]         95 2985.196194
 [96,]         96 3411.652793
 [97,]         97 3899.031764
 [98,]         98 4456.036301
 [99,]         99 5092.612916
[100,]        100 5820.129047
donator
Activity: 2058
Merit: 1007
Poor impulse control.
September 02, 2012, 04:01:50 AM
#20
The trouble with this Martingale strategy is that it doesn't work as noone has unlimited funds to eventually turn a heads!

BTW, I am completely broke lol gonna have to go deeper into Satoshidice to get out haha - well at least I learned a lesson in gambling

The reason it wont work long term is that the odds are in the house's favour. As you can see from the simulations though, the strategy as outlined above makes it less likely that you run out of funds " to eventually turn a heads". Are you sure you followed the strategy correctly? Post what your variables were and what the outcome was, we'll see if there's an error in the strategy somewhere.
newbie
Activity: 56
Merit: 0
September 02, 2012, 03:57:22 AM
#19
The trouble with this Martingale strategy is that it doesn't work as noone has unlimited funds to eventually turn a heads!

BTW, I am completely broke lol gonna have to go deeper into Satoshidice to get out haha - well at least I learned a lesson in gambling
donator
Activity: 2058
Merit: 1007
Poor impulse control.
August 11, 2012, 03:41:54 AM
#18
Can you provide an example? If I have made a mistake with this strategy, a specific example would be useful.
hero member
Activity: 793
Merit: 1026
August 11, 2012, 03:10:50 AM
#17
Martingale actually loses you more than straight flat betting, since you wager more.
donator
Activity: 2058
Merit: 1007
Poor impulse control.
August 09, 2012, 09:54:24 PM
#16
Can't help there, sorry. But please do post the script (or a link to it) here if you get one up and running.
member
Activity: 98
Merit: 10
(:firstbits => "1mantis")
August 09, 2012, 08:43:00 PM
#15
All we need now is a script to put this in motion Smiley
full member
Activity: 213
Merit: 100
July 26, 2012, 10:00:14 PM
#14
Hello I'm not the best with math (I'm on 15, taking Calculus next year)
You're gambling? Aren't you a little too young to gamble?
Quote
and I was wondering how you got this:

4. p = 8000/65536, q = 1 - p

How do I calculate this correctly?

The "win odd" column on the website provides the odds as a percentage. So starting with the "Price Multiplier", (in this case 8x) look along the row until you come to the "Win odd" column. This is 12.2070%. Divide by 100 to get 0.122070, and that is your 'p'. Subtract from 1 and that is your 'q'.

Quote
Amazing work by the way!

Also is a higher amount of bets a less of a chance of losing more?

Well thank you. The actual chance that you'll lose money long term is not affected by the strategy - in the long term you'll lose by the hose odds as a percentage of what you've bet, so as a percentage of your bets you'll actually lose more. But the number of bets has little effect on the probability of losing everything you have in one run of bad luck, which risk is what this strategy is designed to minimise.

Thank you for the explanation. And I mined these Bitcoins so technically I can do what I want :p I only bet in small amount like 0.05 though.

And my first bet should be [1,] not init right?
donator
Activity: 2058
Merit: 1007
Poor impulse control.
July 26, 2012, 09:49:19 PM
#13
Hello I'm not the best with math (I'm on 15, taking Calculus next year)
You're gambling? Aren't you a little too young to gamble?
Quote
and I was wondering how you got this:

4. p = 8000/65536, q = 1 - p

How do I calculate this correctly?

The "win odd" column on the website provides the odds as a percentage. So starting with the "Price Multiplier", (in this case 8x) look along the row until you come to the "Win odd" column. This is 12.2070%. Divide by 100 to get 0.122070, and that is your 'p'. Subtract from 1 and that is your 'q'.

Quote
Amazing work by the way!

Also is a higher amount of bets a less of a chance of losing more?

Well thank you. The actual chance that you'll lose money long term is not affected by the strategy - in the long term you'll lose by the hose odds as a percentage of what you've bet, so as a percentage of your bets you'll actually lose more. But the number of bets has little effect on the probability of losing everything you have in one run of bad luck, which risk is what this strategy is designed to minimise.
full member
Activity: 213
Merit: 100
July 26, 2012, 09:32:52 PM
#12
Hello I'm not the best with math (I'm on 15, taking Calculus next year) and I was wondering how you got this:

4. p = 8000/65536, q = 1 - p

How do I calculate this correctly?

Amazing work by the way!

Also is a higher amount of bets a less of a chance of losing more?
newbie
Activity: 59
Merit: 0
July 23, 2012, 10:45:48 PM
#11
i have been using this last longer strategy for the past 5 hours on and off, and i must say, i am impressed, i have lasted way longer than i would have if i had just been martingale.
While i am positive i will lose my measly 1 btc investment, this provides enough entertainment to be well worth it. I have been testing this on the 36% 48% and 24% bets, and it has greatly extended the time i still have my money. Soon i will go into the lower dice rolls.

I would HIGHLY recommend this to anyone who would like to extend the time they can enjoy SD and its clones
donator
Activity: 2058
Merit: 1007
Poor impulse control.
July 23, 2012, 09:51:20 AM
#10
There was an error in the strategy calculator, reported by ericrw14, a variable I hadn't renamed. Fixed now!

Thanks for the heads up, ericrw14.
donator
Activity: 2058
Merit: 1007
Poor impulse control.
July 23, 2012, 12:09:39 AM
#9
I'll spend some time rejiggering the strategy to take account of fees and the house edge. But you agree in principle that the strategy would minimise losses - on average -  if used?

My initial reaction to this is that it shouldn't be possible to change your rate of loss at this game.  Every bet has the same (negative) expectation.  So no matter how you size your bets, don't you expect to lose at the same rate?

....

In short, you can expect to lose 1.8% (or whatever the house edge currently is) of everything you bet, no matter how you size your bets.

How does that fit in with your idea that you are minimising your losses on average?

My argument above would suggest that the way to minimise your expected losses is to minimise your stake.  i.e. don't play at all.


I guess I haven't explained my idea very well. Sorry!

The strategy's aim is to minimise the probability of spending more than you can afford while playing a number of bets. It can't affect the expectation of a bet - that will always be negative due to the house edge. The strategy's aim is to:

1. Calculate how many losses in a row you might expect for a given probability game and length of play;
2. Adjust the initial bet and multiplier so that the cost of an expected run of losses is equal to the maximum amount of btc you want to lose.

The strategy is a way to play longer, but still you'll lose out in the end as the house margin slowly eats away at your wins. However, if you're just playing for entertainment, this strategy outlines the safest way to do so.

legendary
Activity: 2940
Merit: 1333
July 22, 2012, 08:21:09 PM
#8
I'll spend some time rejiggering the strategy to take account of fees and the house edge. But you agree in principle that the strategy would minimise losses - on average -  if used?

My initial reaction to this is that it shouldn't be possible to change your rate of loss at this game.  Every bet has the same (negative) expectation.  So no matter how you size your bets, don't you expect to lose at the same rate?

If the odds change over time, like in blackjack where you can use the cards you've already seen to deduce the composition of the remaining cards, you can raise your stake when the odds are in your favour and end up with a positive overall expectation.  But with SatoshiDice, like roulette, there's a constant negative expectation.

In short, you can expect to lose 1.8% (or whatever the house edge currently is) of everything you bet, no matter how you size your bets.

How does that fit in with your idea that you are minimising your losses on average?

My argument above would suggest that the way to minimise your expected losses is to minimise your stake.  i.e. don't play at all.
donator
Activity: 2058
Merit: 1007
Poor impulse control.
July 22, 2012, 07:45:07 PM
#7
Yes, that's right.I found that using a geometrically distributed random and then operating on the starts and finishes was much quicker than operating on each throw. It's just an illustration meant to compare between methods, not really give much insight to the method itself.
legendary
Activity: 2940
Merit: 1333
July 22, 2012, 06:15:49 PM
#6
My Internet connection just came back after being down for 24h or so.  I've not had a chance to look at your recent changes.  One thing I'm wondering about is why the losing streaks on your graphs show up as straight lines rather than exponential downward plummets.  Are you not plotting intermediate losses?
donator
Activity: 2058
Merit: 1007
Poor impulse control.
July 22, 2012, 04:21:58 AM
#5
This is a simulator which prints out plots of strategy simulations on the left and naive martingale simulations on the right. It's long because I wanted people that are not used to R to be able to follow the code - so only a few necessary short cuts. When tunning the sim, just change the first four variables.


Code:

library(ggplot2)
library(gridExtra)
####plot functions

####plot strategy based results
strategy.plot.func <- function(r, bets, max, p){

m <- 1 / (1 - 1 / r)
n  <- round(-log (bets * p + 1)/log(1 - p))
init <- (max - n * 0.0005)/(sum(m^(1:n))*(1 - sum(m^(1:(n-1)))/(sum(m^(1:n)))*0.005))

rg <- bets + 1
while(round(sum(rg)/10,digits =1) != round(bets/10,digits=1)) {
if(bets*p < 3){stop("increase number of bets or change to higher payout game"); break}
rg <- rgeom(bets*p, p) + 1}

cost.func <- function(x){sum(init/(1-p)^(0:rg[x]))}
win.func <- function(x){init/(1-p)^rg[x] * r}
cost <- sapply(1:(length(rg)), cost.func)
win <- sapply(1:(length(rg)), win.func)

x <- cbind(seq(1,length(cost)*2,2),cost*-1)
y <- cbind(seq(2,length(win)*2,2),win)
z <- rbind(x,y)
z <- z[order(z[,1]),]
a <- cbind(seq(1,length(rg)*2,2),rg-1)
b <- cbind(seq(2,length(rg)*2,2),1)
c <- rbind(a,b)
c <- c[order(c[,1]),]

plot.df <- data.frame(bets = cumsum(c[,2]), btc = cumsum(z[,2]))
plot <- ggplot(plot.df) + geom_line(aes(bets, btc)) +
opts(title=paste(bets,"bets, max loss =",max,"btc, p =", p*65536,"/ 65536"))
return(plot)
}

####plot naive martingale results
naive.plot.func <- function(r, bets, p){

m <- 2
init <- 1

rg <- bets + 1
while(round(sum(rg)/10,digits =1) != round(bets/10,digits=1)) {
if(bets*p < 3){stop("increase number of bets or change to higher payout game"); break}
rg <- rgeom(bets*p, p) + 1}

cost.func <- function(x){sum(init/(1-p)^(0:rg[x]))}
win.func <- function(x){init/(1-p)^rg[x] * r}
cost <- sapply(1:(length(rg)), cost.func)
win <- sapply(1:(length(rg)), win.func)

x <- cbind(seq(1,length(cost)*2,2),cost*-1)
y <- cbind(seq(2,length(win)*2,2),win)
z <- rbind(x,y)
z <- z[order(z[,1]),]
a <- cbind(seq(1,length(rg)*2,2),rg-1)
b <- cbind(seq(2,length(rg)*2,2),1)
c <- rbind(a,b)
c <- c[order(c[,1]),]

plot.df <- data.frame(bets = cumsum(c[,2]), btc = cumsum(z[,2]))
plot <- ggplot(plot.df) + geom_line(aes(bets, btc)) +
opts(title=paste("Naive martingale,",bets,"bets, p =", p*65536,"/ 65536"))
return(plot)
}



#change these variables to suit
r <- 8
p <- 8000/65536
bets <- 100
max <- 1


png(paste("sd", rounds,max,p*65536,".png", sep='.'), height = 500*2, width = 500*16/9)
   grid.newpage()
    pushViewport(viewport(layout = grid.layout(nrow = 4, ncol = 2,
            heights = unit(c(1,1), "null"),
         default.units = "null", respect = FALSE,
        just="centre")))
    vplayout <- function(x, y)
        viewport(layout.pos.row = x, layout.pos.col = y)

print(strategy.plot.func(r, bets, max, p), vp = vplayout(1,1))
print(strategy.plot.func(r, bets, max, p), vp = vplayout(2,1))
print(strategy.plot.func(r, bets, max, p), vp = vplayout(3,1))
print(strategy.plot.func(r, bets, max, p), vp = vplayout(4,1))

print(naive.plot.func(r, bets, p), vp = vplayout(1,2))
print(naive.plot.func(r, bets, p), vp = vplayout(2,2))
print(naive.plot.func(r, bets, p), vp = vplayout(3,2))
print(naive.plot.func(r, bets, p), vp = vplayout(4,2))


dev.off()

Running this in R gives:

donator
Activity: 2058
Merit: 1007
Poor impulse control.
July 22, 2012, 03:23:02 AM
#4
I altered the original post after dooglus' suggestions, taking into account fees and returns on losing. Anyone else see any errors?

Here's a handy-dandy calculator for the strategy, written in R.  It shouldn't be too hard to translate to python. The allbets.func function prints out a list of bets according to the strategy. Start the first bet at line 1. If you lose, make the second at line 2, etc. When you win, return to line 1.

Code:



#reports strategy parameters
strategy.func <- function(r, bets, max, p){
m <- 1 / (1 - 1 / r)
n   <- round(-log (bets * p + 1)/log(1 - p))
init <- (max - n * 0.0005)/(sum(m^(1:n))*(1 - sum(m^(1:(n-1)))/(sum(m^(1:n)))*0.005))
pc.loss <- (1 - (init*m^n*r - 0.0005)/(init*m^n*r)) * 100
return(noquote(paste("m =",m," |  init =",init," |  percentage loss to fees =",pc.loss,"%.")))
}


#reports order of martingale betting
allbets.func <- function(r, bets, max, p){
m <- 1 / (1 - 1 / r)
n   <- round(-log (bets * p + 1)/log(1 - p))
init <- (max - n * 0.0005)/(sum(m^(1:n))*(1 - sum(m^(1:(n-1)))/(sum(m^(1:n)))*0.005))
mat <- matrix(c(1:bets,round(init*m^(1:bets), 6)),bets,2)
colnames(mat)<-c("bet number", "bet amount" )
return(mat)
}

#change these variables to suit
r <- 8
p <- 8000/65536
bets <- 100
max <- 1

strategy.func(r, bets, max, p)

allbets.func(r, bets, max, p)




Output:

Code:
> strategy.func(r, bets, max, p)
[1] m = 1.14285714285714  |  init = 0.10186450536666  |  percentage loss to fees = 0.027536291774799 %.
>
> allbets.func(r, bets, max, p)

      bet number bet amount
 [1,]          1   0.116417
 [2,]          2   0.133048
 [3,]          3   0.152054
 [4,]          4   0.173776
 [5,]          5   0.198602
 [6,]          6   0.226973
 [7,]          7   0.259398
 [8,]          8   0.296455
 [9,]          9   0.338805
[10,]         10   0.387206
donator
Activity: 2058
Merit: 1007
Poor impulse control.
July 21, 2012, 09:30:47 PM
#3
Thanks for the comments, dooglus - I always post too late (after work) and I try not to make mistakes but I'm glad someone caught them.

Define p before using it.  I'm not sure if it's my chance of winning or losing at this point.

I'd originally put the warning after the algorithm, then stupidly moved it up. I moved it back so p would be defined.

1. Let number of rounds  you want to play = "rounds"

In the previous thread, you were using 'round' to refer to "a sequence of plays ending in a win".  I think now you may be using it to mean "a single bet, win or lose".  Is that right?  With martingale betting each round (a sequence of plays ending in a win) ends with a net win equal to your initial bet.  (-1 + -2 + -4 + -8 + 16 == 1) so people may have a target number of these kinds of rounds, giving a target net win.  Or they may have a certain amount of time, and so a target number of bets.  Best to make it clear which you're talking about.

You're right. I've edited the post to make it clear I'm referring to the total number of bets a player wants to make at a certain probability.

4. Let the multiplier each round after a loss be "m", m = 1/q

I think I need to multipy by a little more than 1/q to recoup my losses.  If the house edge was 0% then multiplying by 1/q would be enough, but it's not.  To keep the net win the same whenever the win happens, define m = 1/(1 - 1/mult) where mult is the payout multiplier.
I hadn't read enough about the game so I'm glad you were on the case. I'd been assuming the multiplier was was 1/p since there were fees.

 This still ignores the fact that you're paid half a percent of your stake when you lose, and are charged 0.0005 BTC on every payout, win or lose).

I should address the fees too. Why do people have to make money from their businesses? It would make life much easier for me if they didn't Wink

I'll spend some time rejiggering the strategy to take account of fees and the house edge. But you agree in principle that the strategy would minimise losses - on average -  if used? My next thought was to find parameters that reduce variance the most. Any ideas?

I have only one coin to spare and a days to spare

Fixed!
Pages:
Jump to: