Thread Rating:

conroe64
conroe64
  • Threads: 1
  • Posts: 2
Joined: Sep 7, 2012
September 7th, 2012 at 11:30:30 PM permalink
I wanted to answer the question(s):

1. If I played Deuces Wild Full Pay with optimal strategy, on average, how many plays would it take to earn 800 credits ($1000 playing 5 x $0.25), and how many to earn 8000 credits ($10,000, 5 x $0.25)?
2. What is the average amount of bankroll would you need to not bust out for these two scenarios?

I wrote a program to do this, Monte Carlo style, using the probability table from here (first table on the page):Basically, I'd generate a random number to represent each play, and use that to calculate a payoff.

The results were surprising, and I wanted to know whether they seem to be statistically accurate with what you would expect. Here they are:


Profit Average plays Average Needed Bankroll
800 credits 121444.221 1011.42 credits
8000 credits 1065415.168 1475.317 credits


This was over 1000 trials.

My code is below if you want to see it, or try it yourself (java). Note that it will just spit out the raw results, and you'll need to massage it using a spreadsheet or something first.

Anyway, this is far more trials than I expected, since 800 (profit objective) / 0.76 (average profit per play) = 1052.63 (total hands to win on average profit objective). Do these results make sense, or am I missing something (or have a bug in my code?)


import java.security.SecureRandom;
import java.util.ArrayList;


public class DeucesWild {
private static Chance [] chances =
new Chance [] { new Chance("Natural royal flush ",800 ,440202756l),
new Chance("Four deuces ",200 ,4060462824l),
new Chance("Wild royal flush ",25 ,35796957696l),
new Chance("Five of a kind ",15 ,63818309856l),
new Chance("Straight flush ",9 ,83087969280l),
new Chance("Four of a kind ",5 ,1294427430576l),
new Chance("Full house ",3 ,423165297240l),
new Chance("Flush ",2 ,334561280724l),
new Chance("Straight ",2 ,1117664265756l),
new Chance("Three of a kind ",1 ,5674784779512l),
new Chance("Nothing ",0 ,10901423560980l),
};

public static class Chance
{
String name;
int payoff;
long odds; //get it? :/

public Chance(String name, int payoff, long odds) {
super();
this.name = name;
this.payoff = payoff;
this.odds = odds;
}


}

private static final long TOTAL = 19933230517200l;

public static final int INITIAL_PLAYS = 0;

public static final int [] RECORDED_PROFITS = { 800, 8000 };

public static final int NUM_PLAYERS = 1000;

public ArrayList<Results> results = new ArrayList<Results>();


public static class Results
{
ArrayList<PlayStats> playStatsList = new ArrayList<PlayStats>(RECORDED_PROFITS.length);

public static void printCsvHeader() {
for(int i = 0; i < RECORDED_PROFITS.length; i++)
{
System.out.print(RECORDED_PROFITS+",");
PlayStats.printHeader();
if(i == RECORDED_PROFITS.length-1)
System.out.println();
else
System.out.print(",");
}
}

public void printCsv() {
for(int i = 0; i < RECORDED_PROFITS.length; i++)
{
System.out.print(RECORDED_PROFITS+",");
playStatsList.get(i).printCsv();
if(i == RECORDED_PROFITS.length-1)
System.out.println();
else
System.out.print(",");
}
}

public void add(PlayStats ps) {
playStatsList.add(ps);

}
}

public static class PlayStats
{
int numPlays;
int minBalance, maxBalance, endingBalance;
private int recordedProfitIndex;


public PlayStats(int recordedProfitIndex) {
this.recordedProfitIndex = recordedProfitIndex;
}

public static void printHeader() {
System.out.print("numPlays,minBalance, maxBalance, endingBalance");

}

public void printCsv() {
System.out.print(numPlays+","+minBalance+","+maxBalance+","+endingBalance);
}

public void update(int payoff) {
numPlays ++;
endingBalance += -1 + payoff;
minBalance = Math.min(minBalance,endingBalance);
maxBalance = Math.max(maxBalance,endingBalance);
}

public boolean isWinner() {
return endingBalance >= RECORDED_PROFITS[recordedProfitIndex];
}

public static PlayStats createNextPlayStats(PlayStats ps) {
if(ps.recordedProfitIndex == RECORDED_PROFITS.length -1)
return null; //end of the test

PlayStats newPs = new PlayStats(ps.recordedProfitIndex+1);

newPs.numPlays = ps.numPlays;
newPs.minBalance = ps.minBalance;
newPs.maxBalance = ps.maxBalance;
newPs.endingBalance = ps.endingBalance;

return newPs;
}
}

public static void main(String [] argv)
{
new DeucesWild().start();
}

public void start()
{
long calcTotal = 0;
for(Chance c: chances)
{
calcTotal += c.odds;
}

if(calcTotal != TOTAL)
{
throw new IllegalStateException("bad calcTotal, got "+calcTotal+", expected "+TOTAL);
}

Results.printCsvHeader();
for(int i = 0; i < NUM_PLAYERS; i++)
{
runUntilProfits().printCsv();
}

}

private Results runUntilProfits() {
Results r = new Results();

PlayStats ps = new PlayStats(0);

//first do the initial plays
for(int i = 0; i < INITIAL_PLAYS; i++)
{
ps.update(runPlay());
}

//now we start to save stats
for(;;)
{
if(ps.isWinner())
{
r.add(ps);
ps = PlayStats.createNextPlayStats(ps);

if(ps == null) // if we're at the end of recorded stats, then exit, we're done
break;

//continue to check if that one is also a winner
continue;
}
ps.update(runPlay());
}

return r;
}

private SecureRandom sr = new SecureRandom();

private int runPlay() {
long val = Math.abs(sr.nextLong()) % TOTAL;

for(Chance c : chances)
{
val -= c.odds;
if(val < 0)
return c.payoff;
}

throw new IllegalStateException("why did val run off the end? "+val);
}
}

tringlomane
tringlomane
  • Threads: 8
  • Posts: 6284
Joined: Aug 25, 2012
September 7th, 2012 at 11:45:50 PM permalink
Quote: conroe64


Anyway, this is far more trials than I expected, since 800 (profit objective) / 0.76 (average profit per play) = 1052.63 (total hands to win on average profit objective). Do these results make sense, or am I missing something (or have a bug in my code?)



If only FPDW returned 176%...

I wouldn't need to find a job! :p

800 / 0.0076 (avg profit per play) = 105,263 hands on average.
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
September 8th, 2012 at 12:32:25 AM permalink
Your simulation results seems okay (although 1000 runs are a bit low).

For the bankroll question, you can ask "Kelly" for the optimum betsize as fraction of your bankroll.
From the full probability table, the Kelly bankroll is 2924 times your total betsize, that is $3655.

Note that the Kelly bankroll is *not* your "average downswing" it is the bankroll for which you maximize your bankroll growth when playing a single hand of 5 x $0.25.
Below a bankroll of $1750 (roughly halve a Kelly bankroll) your expected growth is in fact *negative* - which means you would definetly want to stop at this point.
JB
Administrator
JB
  • Threads: 334
  • Posts: 2089
Joined: Oct 14, 2009
September 8th, 2012 at 2:16:10 AM permalink
Quote: conroe64

If I played Deuces Wild Full Pay with optimal strategy, on average, how many plays would it take to earn 800 credits ($1000 playing 5 x $0.25), and how many to earn 8000 credits ($10,000, 5 x $0.25)?


8,000 credits is $2,000. 8,000 bets is $10,000.
FleaStiff
FleaStiff
  • Threads: 265
  • Posts: 14484
Joined: Oct 19, 2009
September 8th, 2012 at 5:36:19 AM permalink
Quote: JB

8,000 credits is $2,000. 8,000 bets is $10,000.


Okay, so how much money would it take and how many free hot dogs would he get while doing this?

(I know I could have asked how many free beers but I'm posting this in the morning hours (I'm pretty sure) and I am trying to mend my ways.)
conroe64
conroe64
  • Threads: 1
  • Posts: 2
Joined: Sep 7, 2012
September 8th, 2012 at 11:28:34 AM permalink
176% ... what a dumb mistake.

Anyway, I ran the program all night and it ran for around 25,000 trials. Here are the results

Profit
Average Plays
Average Needed Bankroll
800 bets
126808.67
1014.18 bets
8000 bets
1074155.91
1530.32 bets


So, to make 1000 dollars, at 500 hands per hour, it'd take around 126808.67 / 500 = 253.6 hours = 31.7 days playing 8 hours a day., and I'd need on average 1014.18 x $1.25 = $1267.73

I calculated one more thing with my program. If you play 100 initial hands, and then played until you broke even, how long, on average would it take (this includes cases where you were ahead after the first 100 plays, in which case you'd quit immediately). Here are the results after 25,000 trials

Profit
Average Plays
Average Needed Bankroll
Break even after 100 plays
6968.81
141.89 bets


The worst case in the 25,000 trials was 2085933 plays (4172 hours or 521 days working 8 hours a day) with a needed bankroll of 10029 bets or $12536.25
buzzpaff
buzzpaff
  • Threads: 112
  • Posts: 5328
Joined: Mar 8, 2011
September 8th, 2012 at 11:41:58 AM permalink
800 credits 121444.221 1011.42 credits


Your program has an error or is rounding up.

I came up with 1011.416
  • Jump to: