Monday, September 29, 2014

Blackjack Simulation Results - Player Stats

Background

If you look back at me previous two posts, you can see that I have been working on a Blackjack simulation in an attempt to beat the CSM. Funny, I know...

I apologize for the "ascii art" graphs. Right now, all my code is a quick and dirty simulation. I am planning to expose the code functionality with a GWT front-end with interactive, pretty D3 graphs. 

Basic Strategy

The following arrays were used as the basic strategy logic for the player.

private static final Character[][] HARD_BS = new Character[][] { {/* 0 */},{/* 1 */},{/* 2 */},{/* 3 */},{/* 4 */},
        //  2   3   4   5   6   7   8   9  10   A
        {  'H','H','H','H','H','H','H','H','H','H' }, // 5
        {  'H','H','H','H','H','H','H','H','H','H' }, // 6
        {  'H','H','H','H','H','H','H','H','H','H' }, // 7
        {  'H','H','H','H','H','H','H','H','H','H' }, // 8
        {  'H','D','D','D','D','H','H','H','H','H' }, // 9
        {  'D','D','D','D','D','D','D','D','H','H' }, // 10
        {  'D','D','D','D','D','D','D','D','D','H' }, // 11
        {  'S','S','S','S','S','H','H','H','H','H' }, // 12
        {  'S','S','S','S','S','H','H','H','H','H' }, // 13
        {  'S','S','S','S','S','H','H','H','H','H' }, // 14
        {  'S','S','S','S','S','H','H','H','r','H' }, // 15  r = RH
        {  'S','S','S','S','S','H','H','r','r','r' }, // 16  r = RH
        {  'S','S','S','S','S','S','S','S','S','S' }, // 17
        {  'S','S','S','S','S','S','S','S','S','S' }, // 18
        {  'S','S','S','S','S','S','S','S','S','S' }, // 19
        {  'S','S','S','S','S','S','S','S','S','S' }, // 20
        {  'S','S','S','S','S','S','S','S','S','S' }, // 21
    };
    
    private static final Character[][] SOFT_BS = new Character[][] { {/* 0 */}, {/* 1 */},
        //  2   3   4   5   6   7   8   9  10   A
        {  'H','H','H','D','D','H','H','H','H','H' }, // A,2
        {  'H','H','H','D','D','H','H','H','H','H' }, // A,3
        {  'H','H','D','D','D','H','H','H','H','H' }, // A,4
        {  'H','H','D','D','D','H','H','H','H','H' }, // A,5
        {  'H','D','D','D','D','H','H','H','H','H' }, // A,6
        {  'S','d','d','d','d','S','S','H','H','H' }, // A,7  d = DS
        {  'S','S','S','S','S','S','S','S','S','S' }, // A,8
        {  'S','S','S','S','S','S','S','S','S','S' }, // A,9
        {  'S','S','S','S','S','S','S','S','S','S' }, // A,10
    };
    
    private static final Character[][] DOUBLE_BS = new Character[][] { {/* 0 */}, {/* 1 */},
        //  2   3   4   5   6   7   8   9  10   A
        {  'P','P','P','P','P','P','H','H','H','H' }, // 2,2 
        {  'P','P','P','P','P','P','H','H','H','H' }, // 3,3
        {  'H','H','H','P','P','H','H','H','H','H' }, // 4,4
        {  'H','H','H','H','H','H','H','H','H','H' }, // 5,5
        {  'P','P','P','P','P','H','H','H','H','H' }, // 6,6
        {  'P','P','P','P','P','P','H','H','H','H' }, // 7,7
        {  'P','P','P','P','P','P','P','P','P','P' }, // 8,8
        {  'P','P','P','P','P','S','P','P','S','S' }, // 9,9
        {  'S','S','S','S','S','S','S','S','S','S' }, // 10,10
        {  'P','P','P','P','P','P','P','P','P','P' }, // A,A
    };

Player Stats

Here are the collected stats for a player using basic strategy over 10 million blackjack hands.

Hand Results Stats

Win Loss Ratio
 Win|****************************** 42.28%
Lose|*********************************** 49.59%
Push|****** 8.11%
===========================================================================
        10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Hard, Soft, Double Distribution
  HARD|***************************************************** 74.32%
  SOFT|********** 14.07%
DOUBLE|********* 11.60%
=============================================================================
          10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Hard Hand Distribution
      Win|************************** 37.13%
     Lose|*************************************** 55.61%
     Push|****** 7.25%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Soft Hand Distribution
      Win|********************************************* 63.39%
     Lose|******************** 28.17%
     Push|****** 8.43%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Double Hand Distribution
      Win|******************************************* 61.35%
     Lose|***************** 23.02%
     Push|*********** 15.61%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Starting Card Stats

Starting Score Distribution
 4|* 0.30%
 5|* 1.25%
 6|** 1.52%
 7|** 2.43%
 8|*** 2.92%
 9|*** 3.66%
10|**** 4.32%
11|**** 4.97%
12|******* 9.24%
13|******* 9.78%
14|******* 8.72%
15|****** 8.38%
16|****** 7.25%
17|****** 7.34%
18|***** 6.50%
19|***** 6.12%
20|******** 10.42%
21|**** 4.78%
=========================================================================
      10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Chance of Winning For Each Starting Score
 4|******************* 26.63%
 5|*********************** 32.59%
 6|********************** 30.38%
 7|*********************** 31.75%
 8|************************** 36.09%
 9|****************************** 42.51%
10|*********************************** 49.62%
11|************************************** 53.62%
12|*********************** 32.18%
13|*********************** 32.62%
14|********************** 31.28%
15|****************** 25.29%
16|***************** 23.16%
17|********************** 30.62%
18|******************************* 42.98%
19|**************************************** 57.07%
20|************************************************** 70.21%
21|******************************************************************* 95.52%
=========================================================================
      10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Chance of Losing For Each Starting Score
 4|*********************************************** 65.93%
 5|******************************************** 62.85%
 6|********************************************** 64.48%
 7|******************************************* 60.21%
 8|*************************************** 55.46%
 9|********************************** 48.35%
10|***************************** 40.18%
11|**************************** 39.41%
12|********************************************* 63.07%
13|******************************************** 62.81%
14|********************************************* 64.24%
15|*************************************************** 72.08%
16|***************************************************** 74.96%
17|*************************************** 55.59%
18|******************************* 43.62%
19|********************* 29.56%
20|********* 12.02%
21| 0.0%
=========================================================================
      10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Note: The following graph has negative values that are represented as zero.

Player Edge For Each Starting Hand
 4| -39.29%
 5| -30.25%
 6| -34.10%
 7| -28.45%
 8| -19.36%
 9| -5.84%
10|******* 9.44%
11|********** 14.20%
12| -30.89%
13| -30.18%
14| -32.96%
15| -46.78%
16| -51.79%
17| -24.96%
18| -0.64%
19|******************** 27.51%
20|***************************************** 58.18%
21|******************************************************************* 95.52%
=========================================================================
      10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Busting Stats

The following is the chance of busting given that you have the specific total showing. Note that the rows do NOT sum to 1.

Chance of Busting For Each Starting Score
 4|************************ 33.90%
 5|**************** 21.48%
 6|******************* 25.90%
 7|********** 13.86%
 8|********* 12.65%
 9|********* 11.70%
10|****** 7.50%
11|* 1.08%
12|******************** 27.28%
13|******************* 27.10%
14|********************* 29.76%
15|************ 16.90%
16|******** 11.15%
17|** 2.01%
18|** 1.57%
19| 0.0%
20| 0.0%
21| 0.0%
=========================================================================
      10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|


Given all of the hands with totals exceeding 21, each row represents the probability that the busted hand had the corresponding starting value. Note that in the graph above, it is likely to bust when starting with double 2's. However, since the hand is very rare, you are unlikely to lose lot's of money while busting on double 2's.


Starting Score Bust Distribution
 4|* 0.82%
 5|** 2.15%
 6|*** 3.15%
 7|** 2.68%
 8|*** 2.95%
 9|*** 3.42%
10|** 2.59%
11|* 0.43%
12|*************** 20.12%
13|*************** 21.15%
14|*************** 20.72%
15|******** 11.31%
16|***** 6.45%
17|* 1.18%
18|* 0.81%
19| 0.0%
20| 0.0%
21| 0.0%
=========================================================================
      10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Last Score Before Bust Distribution
12|*********** 15.28%
13|************** 19.85%
14|***************** 24.07%
15|*************** 20.80%
16|************** 19.96%
=========================================================================
      10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Win Loss Ratios Based on Starting Card (annoying dump)

Starting With 4
      Win|******************* 26.63%
     Lose|*********************************************** 65.93%
     Push|****** 7.43%
Surrender| 0.0%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Starting With 5
      Win|*********************** 32.59%
     Lose|******************************************** 62.85%
     Push|**** 4.54%
Surrender| 0.0%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Starting With 6
      Win|********************** 30.38%
     Lose|********************************************** 64.48%
     Push|**** 5.12%
Surrender| 0.0%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Starting With 7
      Win|*********************** 31.75%
     Lose|******************************************* 60.21%
     Push|****** 8.03%
Surrender| 0.0%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Starting With 8
      Win|************************** 36.09%
     Lose|*************************************** 55.46%
     Push|****** 8.44%
Surrender| 0.0%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Starting With 9
      Win|****************************** 42.51%
     Lose|********************************** 48.35%
     Push|******* 9.12%
Surrender| 0.0%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Starting With 10
      Win|*********************************** 49.62%
     Lose|***************************** 40.18%
     Push|******** 10.19%
Surrender| 0.0%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Starting With 11
      Win|************************************** 53.62%
     Lose|**************************** 39.41%
     Push|***** 6.95%
Surrender| 0.0%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Starting With 12
      Win|*********************** 32.18%
     Lose|********************************************* 63.07%
     Push|**** 4.74%
Surrender| 0.0%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Starting With 13
      Win|*********************** 32.62%
     Lose|******************************************** 62.81%
     Push|**** 4.55%
Surrender| 0.0%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Starting With 14
      Win|********************** 31.28%
     Lose|********************************************* 64.24%
     Push|**** 4.47%
Surrender| 0.0%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Starting With 15
      Win|****************** 25.29%
     Lose|********************************** 48.20%
     Push|** 2.61%
Surrender|***************** 23.88%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Starting With 16
      Win|***************** 23.16%
     Lose|****************************** 41.91%
     Push|** 1.87%
Surrender|************************ 33.04%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Starting With 17
      Win|********************** 30.62%
     Lose|*************************************** 55.59%
     Push|********** 13.77%
Surrender| 0.0%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Starting With 18
      Win|******************************* 42.98%
     Lose|******************************* 43.62%
     Push|********** 13.39%
Surrender| 0.0%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Starting With 19
      Win|**************************************** 57.07%
     Lose|********************* 29.56%
     Push|********** 13.35%
Surrender| 0.0%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Starting With 20
      Win|************************************************** 70.21%
     Lose|********* 12.02%
     Push|************* 17.76%
Surrender| 0.0%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Starting With 21
      Win|****************************************************************** 95.52%
     Lose| 0.0%
     Push|**** 4.47%
Surrender| 0.0%
================================================================================
             10%|   20%|   30%|   40%|   50%|   60%|   70%|   80%|   90%|

Next Steps

Since I am trying to beat CSM's (Continuous Shuffle Machines), card counting will not help me. The deck is shuffled after every hand so each card has equal probability of appearing in two consecutive hands. I will have to rely on different betting strategies and might have to alter basic strategy to take advantage of the betting strategies.

No comments:

Post a Comment