Thread Rating:

Poll

3 votes (13.04%)
4 votes (17.39%)
7 votes (30.43%)
2 votes (8.69%)
2 votes (8.69%)
5 votes (21.73%)
1 vote (4.34%)
4 votes (17.39%)
7 votes (30.43%)
6 votes (26.08%)

23 members have voted

ThatDonGuy
ThatDonGuy
Joined: Jun 22, 2011
  • Threads: 99
  • Posts: 4759
July 27th, 2016 at 8:00:28 AM permalink
Quote: LuckyPhow

But, seems to me, after 100 iterations, casino should have won 51 and player should have won 49, for a 2-unit loss for the player. Straight-line extension shows when player goes broke.


However, that includes, for example, the bank winning 40 of the first 55 hands, and then the player winning 34 of the last 45. You never get to those last 45 hands because, after the first 55, you won 15 and lost 40, so you have lost your entire bankroll.

That is the entire point of this problem - how often do you reach the "25 more losses than wins" point in 100 hands?
Romes
Romes
Joined: Jul 22, 2014
  • Threads: 27
  • Posts: 5494
July 27th, 2016 at 8:30:35 AM permalink
Couldn't you try to simplify it further? What's the house edge of the game? 2%? Variance = 1 (given you can only win or lose $1). Why not just run the EV +/- SD to find the ruin probability? I'm okay at math, but not on your guys level, so sometimes I have to reverse engineer things and hack them together with shorter known tricks =P.

Bankroll = $25
AvgBet = 1
OriginalSD = 1*1 = 1

EV(100 trails) = (100*1)*(-.02) = -2
SD(100 trials) = Sqrt(100) * 1 = 10 * 1 = 10 ... 2SD = 20

So in 100 trials one would expect to lose $2 +/- $20... Therefor with 95% confidence one would not bust on a $25 bankroll.

From this we know there's a chance to go broke between 2 and 3 Standard Deviations. So between 95% and 99% confidence intervals. Plot the point and you should be able to find your confidence?

Yeah didn't exactly answer the question, but maybe something more to think about or something? Yeah or something... I'm gonna go with that =P.
Playing it correctly means you've already won.
BleedingChipsSlowly
BleedingChipsSlowly
Joined: Jul 9, 2010
  • Threads: 20
  • Posts: 933
July 27th, 2016 at 9:58:37 AM permalink
Quote: mustangsally

... I gets 0.019520497 for ruin ...

I get that, too! But being me I had to do it my way. Here's my result:

Calculating for initial bankroll of 25 wager of 1 for 100 bets with 0.49 probability of winning 1 for each bet, else losing.

Probability of bust: 0.019520496908388644

LIke mustangsally's work, mine also has a compete breakdown of possible results if you care to examine the result array.


<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Free Play Resolved</title>
</head>
<body>
<script>
const b = 25; //bankroll
const wp = 0.49; //probabilty of winning
const lp = 1 - wp; //probability of losing
const n = 100; //number of bets to process
var bp = []; //bankroll amount probability

//Initialize the bankroll probability array
for (let i=0;i<=b+n;i++) {bp=0;}
bp = 1;

document.write("<p>Calculating for initial bankroll of "+b+" wager of 1 for "+n+" bets with "+wp+" probability of winning 1 for each bet, else losing.</p>");

for (let bet=1;bet<=n;bet++){ //For each bet
let br = bp.slice(0); //create a copy to process the bet
for (let i=Math.max(b-bet+1,1);i<b+bet;i++) { //for each possibility where bankroll > 0
if (bp > 0 ) { //act if possibility > 0

//Allocate the current possibiliy to win and loss
br[i-1] += bp * lp;
br[i+1] += bp * wp;
br -= bp;
}
}
bp = br; //Make the working copy the current data
}

document.write("<p>Probability of bust: "+bp[0]+"</p>");

</script>
</body>
</html>


Coding got munched by the spoiler tag. Oh well, still valid.
“You don’t bring a bone saw to a negotiation.” - Robert Jordan, former U.S. ambassador to Saudi Arabia
ThatDonGuy
ThatDonGuy
Joined: Jun 22, 2011
  • Threads: 99
  • Posts: 4759
July 27th, 2016 at 10:34:07 AM permalink
Quote: mustangsally


using a simple transition matrix in Excel
I gets 0.019520497 for ruin (in agreement with a sim I also ran)

there is a paper that shows that method and the Binomial Ruin Distribution named
"The Impact of a Finite Bankroll on an Even-Money Game"
Kelvin Morin – Manitoba Lotteries Corporation


I get the same number, which is not surprising as my code is pretty much the same as her spreadsheet.

Morin's paper is here (makes sense that UNLV would have it).
However, the formula requires calculating two integrals:

P(ruin) = F( (r + 1/2 - np) / sqrt(npq) ) + F( (r - 1/2 - nq) / sqrt(npq) ) exp( 2b(q-p) / (1-(p-q)2 )
where b = the bankroll (in our case, 25)
n = the maximum number of bets (in our case, 100)
p = the win probability (in our case, 0.49)
q = the loss probability = 1 - p (in our case, 0.51)
r = the "ruin point" = (n - b) / 2 (in our case, 37.5. although I think it's supposed to be an integer)
and F(x) = the area underneath the normal distribution curve for values < x;
this is 1 / sqrt(2 PI) * the integral for u from (-infinity) to x of exp(-u2 / 2) du

Using a straightforward approximation for the integrals (starting at the maximum value, calculating the value at intervals of 0.1 until the sum didn't appear to get any larger (in this case, 200), adding them up, and multiplying by the interval width), I got a ruin of 0.018091637 for r = 37 and 0.023785798 for r = 37.5 (which is (100 - 25) / 2). The correct value appears at about r = 37.13783.

Since calculating the integrals is going to require approximation, you might as well calculate the values using a matrix; note that the size of the matrix varies approximately in proportion to the square of the maximum number of bets.
Or, as BleedingChipsSlowly points out, since we're not interested in the intermediate step values, you only really need a one-dimensional matrix (not two, as the numbers in the odd positions are calculated from the numbers in the adjacent even positions, and then the numbers in the even positions are calculated from the numbers in the adjacent odd positions, going back and forth).
Last edited by: ThatDonGuy on Jul 27, 2016
LuckyPhow
LuckyPhow
Joined: May 19, 2016
  • Threads: 52
  • Posts: 678
July 27th, 2016 at 11:36:47 AM permalink
Quote: ThatDonGuy

However, that includes, for example, the bank winning 40 of the first 55 hands, and then the player winning 34 of the last 45. You never get to those last 45 hands because, after the first 55, you won 15 and lost 40, so you have lost your entire bankroll.

That is the entire point of this problem - how often do you reach the "25 more losses than wins" point in 100 hands?



I agree. As several of the other replies seem to mutually confirm, the answer is one seldom (95% probability) encounters such an extreme example as the one you posit. But, it can happen.

Now, back to the Wiz's original issue: a formula for Internet casino bonuses that shows the probability of ruin in a finite number of steps. Is this like the, "Get $$$ welcome bonus" (but it's only available after the player deposits $$$ and plays no fewer than ### hands)? Ideally, the Internet casino (I'm guessing here) would like the player to lose most -- but not all (avoiding "ruin") -- of her buy-in, but then gets the bonus, continues to play, and -- hopefully -- stays as a "regular" at the site. Hey, Wiz! Am I even close to how Internet casinos want to use your formula?

But, as the player gets closer to "ruin" before qualifying for the (anticipated) bonus, the casino gets closer to losing a (new?) player who leaves feeling cheated. Seems to me the Internet casino would most of all want to avoid that. Keeping risk of ruin low for the player also keeps low the Internet casino's risk of losing the player as a customer.
mustangsally
mustangsally
Joined: Mar 29, 2011
  • Threads: 25
  • Posts: 2463
July 27th, 2016 at 12:01:36 PM permalink
Quote: mustangsally

added:
for a very nice approximation formula

my online folder (link in my blog) has the Alan Krigman Excel sheet

(uses Don Schlesinger's trip risk of ruin formula that is very accurate as the number of trials increases)

 I) Survival criterion -- 100 rounds
Risk of ruin = 2.0124%
Prob of survival = 97.9876%




so a small error is there

the Excel sheet is RoR-AlanK.xls
I Heart Vi Hart
Wizard
Administrator
Wizard
Joined: Oct 14, 2009
  • Threads: 1375
  • Posts: 22948
July 27th, 2016 at 12:57:42 PM permalink
Quote: Romes

Couldn't you try to simplify it further? What's the house edge of the game? 2%? Variance = 1 (given you can only win or lose $1). Why not just run the EV +/- SD to find the ruin probability?



The question you seem to be answering is what is the probability of being below zero after 100 hands, assuming you could play on credit if you feel below before.

However, I'm asking what are the chances of ruin at any point. It could happen the player is ruined on hand #90, plays on credit and wins, and finishes 5 units up. He would show a success based on just the result after 100 hands, but if he couldn't get a marker, then he would have busted out.
It's not whether you win or lose; it's whether or not you had a good bet.
Wizard
Administrator
Wizard
Joined: Oct 14, 2009
  • Threads: 1375
  • Posts: 22948
July 27th, 2016 at 1:02:53 PM permalink
Quote: LuckyPhow

Now, back to the Wiz's original issue: a formula for Internet casino bonuses that shows the probability of ruin in a finite number of steps. Is this like the, "Get $$$ welcome bonus" (but it's only available after the player deposits $$$ and plays no fewer than ### hands)? Ideally, the Internet casino (I'm guessing here) would like the player to lose most -- but not all (avoiding "ruin") -- of her buy-in, but then gets the bonus, continues to play, and -- hopefully -- stays as a "regular" at the site. Hey, Wiz! Am I even close to how Internet casinos want to use your formula?



Actually, the way Internet casino bonuses usually work is they give it to you after you make a deposit. However, to make a withdrawal you have to play through the combined deposit and bonus x number of times. Then, if you survive all the play, they will deduct the bonus from your account and you can withdraw the rest.
It's not whether you win or lose; it's whether or not you had a good bet.
Romes
Romes
Joined: Jul 22, 2014
  • Threads: 27
  • Posts: 5494
July 27th, 2016 at 1:03:25 PM permalink
Ah, my mistake. Though I suppose I could just write a similar program to calculate the chances of being broke at each step up to 100 as well. It would be the same calculations just the NumHands would change. Basically, if I'm understanding correctly, I'm only looking at after 100 hands and you said you want to know about hand 1, 2, 3, 4, 5, ...100.
Playing it correctly means you've already won.
Wizard
Administrator
Wizard
Joined: Oct 14, 2009
  • Threads: 1375
  • Posts: 22948
July 27th, 2016 at 1:34:21 PM permalink
Quote: mustangsally

the Don Schlesinger formula is a good one to use too.



Thanks. I must have brushed over that too quickly when I read his book. I just posted it to my private Facebook account.

I'm very impressed at the formula but is probably too advanced to implement in a simple JavaScript calculator.
It's not whether you win or lose; it's whether or not you had a good bet.

  • Jump to: