Results 1 to 8 of 8

Thread: Errors in outputting data in Monte Carlo Sim

  1. #1


    Did you find this post helpful? Yes | No

    Errors in outputting data in Monte Carlo Sim

    Hi everyone, this is my first post here, so if this isn't the right place for it, I apologize and am happy to move it.

    I'm writing my own simulator to calculate BS by randomizing player decisions and storing the results, then calculating the EV of each decision. However, I'm not sure if the structure I'm using to store results is correct.

    My results are going into one of two data structures:

    1) A map of scenarios that [hit/double/split] leads to, and the number of times each route gets mapped. The scenarios are strings representing the player hand and dealer upcard i.e. "s18_A" represents any soft 18 against an ace (soft and splitable hands are stored separately, but otherwise hand composition is ignored).
    dictionary<string, dictionary<action, dictionary<string, int>>>

    2) A dictionary of outcome scenarios and results for any final hand [stand/double/bust] (excluding player/dealer BJ, and surrender which is calculated seperately). These scenarios combine hard, soft, and splitable hands since once they are final, it shouldn't matter. The ResultValue is a custom object that I can calculate the EV of the result.
    dictionary<string, ResultValue>

    With me so far? Please let me know if I'm on the wrong path.

    Using this, I'm able to recursively map the hit/double/split paths and compare the EV of each decision to put together basic strategy. These are the results of a 500 million round sim (3:2 6D 1pen H17 DAS nRSA SP4 LS):

    Upcard 2 3 4 5 6 7 8 9 10 A
    4 Hit Hit Hit Hit Hit Hit Hit Hit Hit Hit
    5 Hit Hit Hit Hit Hit Hit Hit Hit Hit Hit
    6 Hit Hit Hit Hit Hit Hit Hit Hit Hit Hit
    7 Hit Hit Hit Hit Hit Hit Hit Hit Hit Hit
    8 Hit Hit Hit Hit Hit Hit Hit Hit Hit Hit
    9 Hit Double Double Double Double Hit Hit Hit Hit Hit
    10 Double Double Double Double Double Double Double Double Hit Hit
    11 Double Double Double Double Double Double Double Double Double Double
    12 Hit Hit Stand Stand Stand Hit Hit Hit Hit Hit
    13 Stand Stand Stand Stand Stand Hit Hit Hit Hit Hit
    14 Stand Stand Stand Stand Stand Hit Hit Hit Hit Hit
    15 Stand Stand Stand Stand Stand Hit Hit Hit Surrender Surrender
    16 Stand Stand Stand Stand Stand Hit Hit Surrender Surrender Surrender
    17 Stand Stand Stand Stand Stand Stand Stand Stand Stand Surrender
    18 Stand Stand Stand Stand Stand Stand Stand Stand Stand Stand
    19 Stand Stand Stand Stand Stand Stand Stand Stand Stand Stand
    20 Stand Stand Stand Stand Stand Stand Stand Stand Stand Stand
    21 Stand Stand Stand Stand Stand Stand Stand Stand Stand Stand
    s13 Hit Hit Hit Double Double Hit Hit Hit Hit Hit
    s14 Hit Hit Hit Double Double Hit Hit Hit Hit Hit
    s15 Hit Hit Double Double Double Hit Hit Hit Hit Hit
    s16 Hit Hit Double Double Double Hit Hit Hit Hit Hit
    s17 Hit Double Double Double Double Hit Hit Hit Hit Hit
    s18 Double Double Double Double Double Stand Stand Hit Hit Hit
    s19 Stand Stand Stand Stand Double Stand Stand Stand Stand Stand
    s20 Stand Stand Stand Stand Stand Stand Stand Stand Stand Stand
    s21 Stand Stand Stand Stand Stand Stand Stand Stand Stand Stand
    tA Split Split Split Split Split Split Split Split Split Split
    t2 Hit Split Split Split Split Hit Hit Hit Hit Hit
    t3 Hit Split Split Split Split Hit Hit Hit Hit Hit
    t4 Hit Hit Hit Hit Split Hit Hit Hit Hit Hit
    t5 Double Double Double Double Double Double Double Double Hit Hit
    t6 Split Split Split Split Split Hit Hit Hit Hit Hit
    t7 Split Split Split Split Split Split Hit Hit Hit Hit
    t8 Split Split Split Split Split Split Split Split Split Surrender
    t9 Split Split Split Split Split Stand Split Split Stand Stand
    t10 Stand Stand Stand Stand Stand Stand Stand Stand Stand Stand



    The red values are where my strategy differs from BJA's H17 BS. I suspect the errors might be caused by the way I am weighting the EV of splits. To do this, I'm summing the proportional EV of every possible outcome for a split hand EXCEPT for resplits (because that would cause an infinite loop). Then I'm multiplying the summed EV for an individual split hand by the average number of split hands it would result in (2 + probability of resplit)

    Please let me know if there are issues with my logic or anything I might not have considered. I appreciate the help!
    Attached Images Attached Images

  2. #2


    Did you find this post helpful? Yes | No
    I play the hands each way (hit, stand, double, split if a pair) and just record the number of hands played vs. the amount won for each action, then calculate the win rates from that. That includes doubles and resplits. Surrender win rate is -0.5. I get an array of arrays like this, [-0.473066,0.1251093,-0.04952487,null,-0.5], one for each hand/upcard combination. If you can set a maximum number of splits per round, for aces (1) vs. the rest (3), you shouldn't have infinite loops.

  3. #3


    Did you find this post helpful? Yes | No
    Thanks for your reply. When you play the hand each way, how do you progress through the deck? Or do you? For example:


    Shoe: [2, 6, 2, 5, 10, Q, K, 8, 9...]


    Once dealt, the player will have 2,2 against dealer 5.
    After standing, [2,6,2,5,10,K] would be discarded, but after doubling, [2,6,2,5,10,K,8] would be discarded.
    You can simulate each action before removing the cards from the deck, but then when you go to the next hand, do you just reshuffle, or chose an arbitrary action to discard its results?


    I'm deriving my results from arrays almost identical to yours. Do you know any books/sources where I can get accurate results to compare to? Or would you be willing to share yours?


    These are some of my values for the incorrect hands (rounding to 3 digits just for display):


    22v2: [H:-0.112 S:-0.287 D:-0.571 T:-0.135 F:-5]
    33v2: [H:-0.139 S:-0.287 D:-0.55 T:-0.178 F:-5]
    22v7: [H:-0.093 S:-0.476 D:-0.949 T:-0.103 F:-5]
    33v7: [H:-0.153 S:-0.474 D:-0.892 T:-0.161 F:-5]
    44v5: [H:0.077 S:-0.156 D:0.019 T:0.05 F:-5]

  4. #4


    Did you find this post helpful? Yes | No
    I can't help you with the programming, but, in addition to all of the split values being wrong, a couple of the hit numbers are wrong, as well. See BJA3, Appendix A.

    Don

  5. #5


    Did you find this post helpful? Yes | No
    I run each hand/upcard combination for each action separately, because I run them until I get to a target margin of error (lately, 0.0005 which is standard error of 0.000194 * 2.5758 for probability of 0.99). And because if you start with the high hand totals, the results can be used by subsequent hands as they are played out. I do this for a range of counts. I take the cards representing the hand/upcard and move them to the beginning of the shoe, then keep them there while dealing the rest of each round from the rest of the shoe. High counts are rare and it takes a long time to find billions of them, so to speed things up, I go back to the shoe position at the beginning of the round (same count) then shuffle the rest of the shoe, lately 80 times (more actually starts to take longer, my guess is because the repetitions make it harder to increase the margin of error).

    As for results to compare to, what Don said.

  6. #6


    Did you find this post helpful? Yes | No
    Quote Originally Posted by DSchles View Post
    I can't help you with the programming, but, in addition to all of the split values being wrong, a couple of the hit numbers are wrong, as well. See BJA3, Appendix A.Don
    Thanks Don, I'll take a look.

    Quote Originally Posted by BackCounter View Post
    High counts are rare and it takes a long time to find billions of them, so to speed things up, I go back to the shoe position at the beginning of the round (same count) then shuffle the rest of the shoe, lately 80 times (more actually starts to take longer, my guess is because the repetitions make it harder to increase the margin of error).
    Interesting. I haven't added counting to my sim yet, but I was going to try rigging the shoe by proportionately adding/removing sets of [2-6] and [10-A] (for hi-lo). Your idea seems better since the counts would naturally come later in the shoe though.

  7. #7


    Did you find this post helpful? Yes | No
    Rigging the deck to get certain counts doesn't work. Tried all kinds of statistical methods. Seems counterintuitive but it's true.

  8. #8


    Did you find this post helpful? Yes | No
    Quote Originally Posted by Chuckles! View Post
    These are the results of a 500 million round sim
    This is not nearly enough rounds for convergence. Think billions.

Similar Threads

  1. Dealingwise in Monte Carlo and Macau
    By Ori in forum General Blackjack Forum
    Replies: 12
    Last Post: 08-18-2017, 12:02 AM
  2. Monte Carlo
    By gj1656 in forum General Blackjack Forum
    Replies: 7
    Last Post: 12-13-2016, 07:36 PM
  3. ComboProf: Monte Carlo/quasi Monte Carlo info sought
    By ComboProf in forum Computing for Counters
    Replies: 4
    Last Post: 11-19-2003, 05:12 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

About Blackjack: The Forum

BJTF is an advantage player site based on the principles of comity. That is, civil and considerate behavior for the mutual benefit of all involved. The goal of advantage play is the legal extraction of funds from gaming establishments by gaining a mathematic advantage and developing the skills required to use that advantage. To maximize our success, it is important to understand that we are all on the same side. Personal conflicts simply get in the way of our goals.