See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 13 of 19

Thread: BJ Combinatorics question

  1. #1


    Did you find this post helpful? Yes | No

    BJ Combinatorics question

    Hi,all
    This is a long shot but maybe Eric or someone like that can help me...
    I've been writing a program to calculate 'perfect play'using combinatorics. I started off with ENHC and 1 deck to keep things simple.
    I've been using the calculator on Wizard of Odds site:
    https://wizardofodds.com/games/blackjack/hand-calculator/
    as well as this one:
    http://www.bjstrat.net/cgi-bin/cdca.cgi
    to check my answers as I go along.

    My program gives correct EV if the player STANDS on his first two cards in all situations.
    My program also gets correct EV results if the player HITS his first two cards for 10,10 vs. any dealer card down through 10,6 vs. any dealer card.

    The problem starts at 10,5 vs certain dealer's cards.
    My program is correct for 10,5 vs. 10, but my program is incorrect if the player HITS 10,5 vs. a dealer 9 (my EV is more negative by 0.0007 than the online calculators) or a dealer 8 (more negative by 0.0041)or a dealer 7 (more negative by 0.0036). Specifically, for 10,5 vs.9, my program calculates EV = -0.4760 while the online calculators show -0.4753.
    But, my program is correct for 10,5 vs dealer 6 or dealer 5 or dealer 4 or dealer 3 or dealer 2.
    My program is also incorrect for 9,6 vs. 9, 8 or 7 and 8,7 vs. 9,8, or 7 but correct for 9,6 and 8,7 vs. all else.

    So, the problem only shows up with a player 15 vs. a dealer 9,8 or 7.


    I thought I could isolate the problem further by using the online calculators to check each constituent part of my calculations. So, I used the Wizard of Odd's calculator to give me the EV for a 10,5,10 vs. 9 and 10,5,9 vs. 9 and so on. Then, I took those EV's and multiplied them by the probability that such a hand could occur and added them all up for a total EV if you HIT 10,5 vs. dealer 9 as follows:


    105vs9HIT.jpg

    So, using the online calculators' EV numbers for each individual possible hand when you hit 10,5 vs. 9, I get a number that exactly matches MY program's number when you ask it for EV for hitting 10,5 vs. 9 but doesn't match both of the online calculators when you ask them for EV for hitting 10,5 vs. 9.

    As a further check, I used the same technique as shown in the table above for 10,5 vs. 10 (where my program agrees with the online calculators.) The technique above works for this scenario and gives me the same answers as the online programs and my program (EV for Hit= -0.5418).

    I'm sure there is something wrong with my approach because the online calculators both agree, but I just can't see it. Am I missing something?

    Thanks for any help and best of luck to all!
    SiMi
    Attached Images Attached Images

  2. #2


    2 out of 2 members found this post helpful. Did you find this post helpful? Yes | No
    The author from Bjstrat is a member here(k_c) and has a contact email on his website and is very helpful with programming..Good luck!
    http://bjstrat.net/cgi-bin/cdca.cgi

  3. #3


    Did you find this post helpful? Yes | No
    Hi, JJ
    Thanks for that!
    I'll ask him.

    Best,
    SiMi

  4. #4


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No
    Quote Originally Posted by SiMi View Post
    Hi, JJ
    Thanks for that!
    I'll ask him.

    Best,
    SiMi
    Would it be possible to see source code? Looks likes a simple logical error from the data given.

    After computing the data on your table, it seems that your calcs make sense. Looking in BJA 3rd Ed: Table A10 on pg 403 indicates that

    T5 vs 9
    STAND: -0.535093
    HIT: -0.475256

    So, it would be possible that you are grabbing some incorrect player hand expectations and adding them along the way. That is one or more of your 3-or-more-card hands has either an incorrect expectation, a function returned the incorrect expectation (you returned a STAND EV no a HIT EV for example,) or something completely different that without code cannot be observed.


    I would like to add that Eric, MGP, and others such as Norm, Gronbog, and Dog Hand are also of valuable knowledge. Haven't heard from iCountnTrack lately.

    Also, see this:

    https://www.blackjacktheforum.com/showthread.php?40133-Verifying-Numbers


    EDIT:

    Interesting! Seems for 23 and 24 vs TA, BJA and MGP's BCJA agree with each other on HIT EV, while mines disagrees:

    Code:
                   2              3              4              5              6              7              8              9              T              A
    23
    stand:        -0.29328949    -0.24845160    -0.17585017    -0.10425709    -0.12191464    -0.46891013    -0.51272249    -0.53295368    -0.54637479    -0.65937541    
    hit:          -0.13138669    -0.09824997    -0.04101836    +0.02150482    +0.01923308    -0.11896154    -0.18062883    -0.26209586    -0.30811010    -0.28612709    
    24
    stand:        -0.29096667    -0.23227449    -0.17210562    -0.10137130    -0.11912335    -0.46663771    -0.52215521    -0.53252928    -0.54657842    -0.65871158    
    hit:          -0.15070844    -0.10613753    -0.05524691    +0.00889011    +0.01411278    -0.16347320    -0.23390993    -0.30372645    -0.34547120    -0.32940218
    MGP and I agree for 23 24 vs 7,8,9 on hit, while Cacarulo says otherwise. What do you get SiMi?
    Last edited by lij45o6; 09-17-2018 at 10:05 PM.

  5. #5


    Did you find this post helpful? Yes | No
    Hi, dogman!
    Thanks for the input. A lot of good thoughts in your post. Very helpful!

    I agree that it sure looks like some kind of simple logic error and I was pretty surprised I couldn't find it quickly once I realized it was player cards totaling 15 vs. dealer 9,8 or 7 only. I'll see if I can figure out a concise way to post the relevant code (C++).

    The thing that I'm struggling with at the moment that I wonder if you understand is: why my method of adding up all the individual 3-card hand EV's from one of the online calculators doesn't total to the same thing the same online calculator reports for the Hit EV for the underlying 2-card hand?

    In my example from my OP, I used both the WoOdds site and KC's site. I used my first problem hand: 10,5 vs. dealer 9 (Hit, ENHC 1 deck S17). As you see in the chart I posted, I set up each possible hand you could get if you hit 10,5 and recorded the online calculators' EV.

    So, I took the online calculators' EV for 10,5,10 vs. 9 and the EV for 10,5,9 vs. 9 and the EV for 10,5,8 vs. 9 and so on all the way down to the EV for 10,5,Ace vs. 9. I then calculated the probability that such a hit card would occur (as shown in my table) and multiplied each EV by each probability to get a net EV for that card. Then, I added up all the net EVs to get the overall EV for hitting that underlying hand (in this case, 10,5 vs. dealer 9).

    When I do that, I get the number my program is spitting out BUT IT IS NOT THE NUMBER THE ONLINE CALCULATORS THEMSELVES SHOW.

    That last bit is the part that I don't understand right now and may be a clue to what I'm doing wrong in the code. Even if one is not writing a program to do this, I would think one could verify the online calculators' numbers this way. (It works for other scenarios.)

    So, I suspect I don't understand something and my program is just effectively implementing the same mistake in logic that I made in creating the chart I showed in my post above.

    I've also been trying to develop a formula to calculate the number of possible hands given a scenario so I can verify that my program is generating the right set of hands. So far, I haven't found that formula anywhere. Are you aware of such a formula? Griffin mentions on p.158 that there are 288 possible hands the dealer can create with a 10 up card but Griffin doesn't reveal the formula to make this calculation. I noticed that the dealer can get one of 4 pat hands or a BJ and then the pattern is that he can get 10 different hands starting with 10,6. Then, he can get 19 different hands starting with 10,5. He can get 37 different hands starting with 10,4 and 73 different hands starting with 10,3 and 144 different hands starting with 10,2. The pattern is that the next number of hands is the prior number of hands times 2 minus 1. So:

    10,6 = 10
    10,5 = 19 = (10x2) - 1
    10,4 = 37 = (19x2) -1
    10,3 = 73 = (37x2)-1
    10,2 = 144 = (73x2) - 1 -1 There are only 4 cards with value=1 so you run out of Aces here and have to reduce the number by one.
    Total = 283. Then, add the 4 pat hands and the Blackjack and you get 288 hands, as Griffin wrote. So far, I haven't been able to boil that down to a generic combinatorics function that I can use to make this calculation for any scenario.

    As for the scenario you mentioned (23 and 24 vs. TA), could you please specify the set up again? For example, the player has exactly what cards and the dealer shows exactly what and whether this is 1 deck, ENHC and S17? I'm still writing the code so I created a separate program for STAND and I'm working on the one for HIT now. It's kludgy because I'm being careful at this early stage of development. For HIT, I am limited to ENHC and S17 (one deck) because those were the easiest to start with. Once I encountered this problem, I stopped moving forward because it was clear to me that I am missing something.

    Also, I emailed KC per JJ's suggestion but haven't heard back yet. I will keep you posted if I hear something or make a breakthrough!

    Thanks again for all your time and great ideas! Have a great week!
    SiMi
    Last edited by SiMi; 09-18-2018 at 08:10 AM. Reason: messed up explanation of what I did in chart

  6. #6


    Did you find this post helpful? Yes | No
    Quote Originally Posted by SiMi View Post
    Hi, dogman!
    Thanks for the input. A lot of good thoughts in your post. Very helpful!

    I agree that it sure looks like some kind of simple logic error and I was pretty surprised I couldn't find it quickly once I realized it was player cards totaling 15 vs. dealer 9,8 or 7 only. I'll see if I can figure out a concise way to post the relevant code (C++).
    Consider opening a GitHub? Or some other VCS program that can be viewed by the public.

    Also, much like my BJCA, it is the dealer 7, 8, 9 that differs from Cacarulo but agrees with MGP. Only with dealer T and A is where MGP and Cacarulo agree with one another but I disagree.

    The thing that I'm struggling with at the moment that I wonder if you understand is: why my method of adding up all the individual 3-card hand EV's from one of the online calculators doesn't total to the same thing the same online calculator reports for the Hit EV for the underlying 2-card hand?
    I don't quite understand the bold. Are you asking why your 3-card EV's differ from that of other CA? Then the answer may lie in a logical error somewhere in your ev functions?

    If you want another source for EV's:

    https://github.com/mustgoplay/MGPs-BJ-CA

    In my example from my OP, I used both the WoOdds site and KC's site. I used my first problem hand: 10,5 vs. dealer 9 (Hit, ENHC 1 deck S17). As you see in the chart I posted, I set up each possible hand you could get if you hit 10,5 and recorded the online calculators' EV.

    So, I took the online calculators' EV for 10,5,10 vs. 9 and the EV for 10,5,9 vs. 9 and the EV for 10,5,8 vs. 9 and so on all the way down to the EV for 10,5,Ace vs. 9. I then calculated the probability that such a hit card would occur (as shown in my table) and multiplied each EV by each probability to get a net EV for that card. Then, I added up all the net EVs to get the overall EV for hitting that underlying hand (in this case, 10,5 vs. dealer 9).

    When I do that, I get the number my program is spitting out BUT IT IS NOT THE NUMBER THE ONLINE CALCULATORS THEMSELVES SHOW.

    That last bit is the part that I don't understand right now and may be a clue to what I'm doing wrong in the code. Even if one is not writing a program to do this, I would think one could verify the online calculators' numbers this way. (It works for other scenarios.)

    So, I suspect I don't understand something and my program is just effectively implementing the same mistake in logic that I made in creating the chart I showed in my post above.
    Hmmm....just a question: What is your EV data type? Is if float or double? I use double, while costly in space, allows me to have a more expansive significant. In C (the language I use for my minimal CA,) all decimal values are of type double.

    I've also been trying to develop a formula to calculate the number of possible hands given a scenario so I can verify that my program is generating the right set of hands. So far, I haven't found that formula anywhere. Are you aware of such a formula? Griffin mentions on p.158 that there are 288 possible hands the dealer can create with a 10 up card but Griffin doesn't reveal the formula to make this calculation. I noticed that the dealer can get one of 4 pat hands or a BJ and then the pattern is that he can get 10 different hands starting with 10,6. Then, he can get 19 different hands starting with 10,5. He can get 37 different hands starting with 10,4 and 73 different hands starting with 10,3 and 144 different hands starting with 10,2. The pattern is that the next number of hands is the prior number of hands times 2 minus 1. So:

    10,6 = 10
    10,5 = 19 = (10x2) - 1
    10,4 = 37 = (19x2) -1
    10,3 = 73 = (37x2)-1
    10,2 = 144 = (73x2) - 1 -1 There are only 4 cards with value=1 so you run out of Aces here and have to reduce the number by one.
    Total = 283. Then, add the 4 pat hands and the Blackjack and you get 288 hands, as Griffin wrote. So far, I haven't been able to boil that down to a generic combinatorics function that I can use to make this calculation for any scenario.
    So, let me unpack this for a better understanding to all parties reading:

    "Programming complexities would arise, however, in treating 18 = 9 + 5 + A +3 which would only occur in two sequences; the subroutine necessary to filter out the forbidden orderings in the weighting process might well nullify the time advantage of such an approach based on combinations of cards with a particular order as opposed to permutations derived from the dealer's actual algorithm."

    -ToBJ, Griffin, 6th Ed Ch 11 pg 158.

    Below this paragraph is a BASIC program that would enable you to cycle through all possible dealer hand states. However, it seems that we would run into illegal hand states that would not be permissible in standard 21 rules. The approach I use is to construct a data structure of hand_t that holds the dealers hand as well as attributes related to the hand such as total, n_card, how many soft/hard aces there are (if any), and how many of each rank is in the hand.

    Next, I use a draw function that adds a deuce to the hand until I reach any 17 (assuming the S17 rule here.) So, the hand evolves like this:

    2
    22
    222
    2222
    ...
    222222222

    The next legal hand state would then be:

    222222223

    or 19 for a dealer up-card 2. I continuously increment the last rank element in the hand until I get to an Ace:

    22222222A

    Once I hit an Ace, I remove that card increment the last rank in the hand:

    22222222A
    22222222
    22222223

    and check to see if I need to draw to 17 again. The final dealer hand (again, assuming S17 rule,) should be:

    AAAAAAT9
    AAAAAATT
    AAAAAATA
    AAAAAAA <-this one!

    If you cycle through all of these hands, you should get a grand total of 54433 dealer hands for the S17 rule and 70561 dealer hands for the H17 rule.

    As for your search of a general 'combinatorial function': there is none to the best of my knowledge. Combinatorics deals with counting discrete structures and systems. For computing player/dealer hands, you would simply do enumerations of all possible player/dealer hands. That is what I do. On my computer, enumerating all 3072 unique player keys and 54433/70561 dealer keys takes less than 5/10 of a second, if I do it right.

    As for the scenario you mentioned (23 and 24 vs. TA), could you please specify the set up again? For example, the player has exactly what cards and the dealer shows exactly what and whether this is 1 deck, ENHC and S17? I'm still writing the code so I created a separate program for STAND and I'm working on the one for HIT now. It's kludgy because I'm being careful at this early stage of development. For HIT, I am limited to ENHC and S17 (one deck) because those were the easiest to start with. Once I encountered this problem, I stopped moving forward because it was clear to me that I am missing something.

    Also, I emailed KC per JJ's suggestion but haven't heard back yet. I will keep you posted if I hear something or make a breakthrough!

    Thanks again for all your time and great ideas! Have a great week!
    SiMi
    Good on you for pressing forward and seeking help!

    As for the general rules, I am using the same game rules Griffin used: 1D, S17, nDAS, nSurr. However; one caveat is that you are doing ENHC and I am not. When you said ENCH, all I heard (read) is that you are keeping your EV unconditioned for dealer naturals. If you reread my post "Verifying Numbers", you would see Eric Farmer pointed out the reasoning and the mathematics behind conditioning EV's. If I did not condition my EV's for dealer naturals, you and I should, (for the most part,) have the same Stand/Hit EV's for all hands. I do condition for dealer naturals. Meaning, that I exclude them from the overall analysis of the game and strictly am looking at correct playing EV's *after* the dealer has checked for a blackjack.

    Hope the Helps!

    -dogman

  7. #7


    Did you find this post helpful? Yes | No

    Clarification

    Hi, again, dogman

    Thanks for the great reply! I'll need some time to digest it and will respond more as I have more time. I just wanted to clarify my question in bold because I was afraid it might be confusing and any readers might be lost at this point and I think it's the key to my problem, perhaps.

    If you want to know the EV for Hitting a given player hand vs. a dealer's up card, isn't it valid to give the player every possible hit card and calculate the odds of the totals he gets and then, if the player doesn't bust, give the dealer a chance to play out his hand against the player's total and record the dealer's odds for his totals? Then, add up the EVs for the player-win scenarios and subtract the total of the EVs for the player-losses and you have the overall EV for the initial hand.

    That's what I'm doing in my code and that's what I did in the chart I posted in the OP. Maybe that's not valid for some reason but I can't see why and it seems to yield the same EV as the online calculators for most scenarios.

    If you try to do that same thing using the online calculators from bjstrat.net or WoO web site, you don't always get the same EV for a given hand. As an example, if you ask either of the online calculators to give you the EV for 10,5 vs. 9, they tell you it is -0.4753.

    But, if you add up the EVs shown on those same online calculators for all the individual hands that can occur with a 10,5 vs. 9, you get -0.4760 as shown in the chart in my OP. Notice that this total is different from the EV shown for 10,5 vs. 9 even though you used the same online calculator to generate all the individual EVs that sum up to the overall EV for the hand in question.

    This fact makes me think that the online calculators are NOT using the approach I am using even though my approach works most of the time...

    My program gives the -0.4760 number because it follows the same process shown in the chart in my OP, i.e., my program simply adds up the EV for every possible hand you can get if you start with a 10,5 vs. 9.

    My question is whether you see something wrong with my approach?

    Thanks!
    SiMi

  8. #8


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No
    Quote Originally Posted by SiMi View Post
    Hi, again, dogman

    Thanks for the great reply! I'll need some time to digest it and will respond more as I have more time. I just wanted to clarify my question in bold because I was afraid it might be confusing and any readers might be lost at this point and I think it's the key to my problem, perhaps.

    If you want to know the EV for Hitting a given player hand vs. a dealer's up card, isn't it valid to give the player every possible hit card and calculate the odds of the totals he gets and then, if the player doesn't bust, give the dealer a chance to play out his hand against the player's total and record the dealer's odds for his totals? Then, add up the EVs for the player-win scenarios and subtract the total of the EVs for the player-losses and you have the overall EV for the initial hand.

    That's what I'm doing in my code and that's what I did in the chart I posted in the OP. Maybe that's not valid for some reason but I can't see why and it seems to yield the same EV as the online calculators for most scenarios.

    If you try to do that same thing using the online calculators from bjstrat.net or WoO web site, you don't always get the same EV for a given hand. As an example, if you ask either of the online calculators to give you the EV for 10,5 vs. 9, they tell you it is -0.4753.

    But, if you add up the EVs shown on those same online calculators for all the individual hands that can occur with a 10,5 vs. 9, you get -0.4760 as shown in the chart in my OP. Notice that this total is different from the EV shown for 10,5 vs. 9 even though you used the same online calculator to generate all the individual EVs that sum up to the overall EV for the hand in question.

    This fact makes me think that the online calculators are NOT using the approach I am using even though my approach works most of the time...

    My program gives the -0.4760 number because it follows the same process shown in the chart in my OP, i.e., my program simply adds up the EV for every possible hand you can get if you start with a 10,5 vs. 9.

    My question is whether you see something wrong with my approach?

    Thanks!
    SiMi
    Good to hear back from you!

    So, I just redid the computations using the WOO program for 5T vs 9. I found an error in your computations! Actually, an error in logic to be exact.

    When computing the correct (read: optimal) action for any player hand composition, one must take into account all possible options and choose the one that offer the greatest +EV or the least -EV. In the case of 5T vs 9, we know that standing is -0.535093 units. Now, we need to know if hitting to the next card is better. When we do this, we are looking at not hitting once, but rather if hitting to a specific value is best. That is, from where we start (5T), we want to know the optimal pathway based on hitting EV's and determining what to hit until we need to stand. You accomplish this by computing the hitting EV's for all hard 21 for n_cards 2 through 21. We know the Expectation of drawing any rank to a hard 21: -1. So, we know, after weighing the Expectation with the Probability of the next rank drawn that the Expected Value of hitting a Hard 21 is -1.0000. Now, we then compute hitting all hard 20's. We know that an Ace is the only rank that will allow us to remain in the game so we take the Expectations of both standing and hitting a Hard 20, add the Ace, and find the matching hand state for the Hard 21. Example:

    TT vs 9, to draw and Ace -> TTA vs 9

    The thing we are looking for is what action (hitting or standing,) offers us the best EV. That is, we are looking to see if we should hit; if not, then we stand! We do this by taking the EV for both hitting and standing and comparing them in our hit function:

    if(hand_TTA.stand[dealer_uc] > hand_TTA.hit[dealer_uc])
    hand_TT.hit[dealer_uc] += hand_TTA.stand[dealer_uc] * p_next_card();
    else
    hand_TT.hit[dealer_uc] += hand_TTA.hit[dealer_uc] * p_next_card();

    Think of it this way: You are playing blackjack and get a 5T vs 9. Basic Strategy says to Hit, you hit and draw an Ace. Now, what does BS say? Hit. Why? Because drawing to the next card is more optimal than simply standing (assuming a fresh pack/shoe).

    Now, back to your 5T vs 9 issue. You are assuming that the player can only draw one card on a hit and must stand. This is wrong, as it ignores the fact that with hitting, we can keep going! In fact, we know that with 5TA vs 9, hitting is preferred to standing! That is, the EV for standing and hitting are:

    -0.523800
    -0.515155

    We will then take the most optimal route by drawing another card, even though we are to lose in the long run. But we lose less by following this pathway, rather than assume we can't draw another card for some reason. So, to recompute the *correct* hitting EV for 5T vs 9:

    Dealer 9:

    5TA stand: -0.523800 hit: -0.515155
    5T2 stand: -0.406495 hit: -0.541099
    5T3 stand: -0.185910 hit: -0.623868
    5T4 stand: 0.276627 hit: -0.690504
    5T5 stand: 0.758448 hit: -0.838374
    5T6 stand: 0.940208 hit: -1.000000
    Bust: -1.000000

    Optimal Act:
    5TA hit
    5T2 stand
    5T3 stand
    5T4 stand
    5T5 stand
    5T6 stand

    Weigh each correct EV with the probability of each new draw card and get the correct EV for hitting 5T vs 9:

    E[5TA|Hit] * P(A) + E[5T2|Stand] * P(2) + ... + E[BUST] * P(7-T) = -0.475256

    Basically, you have the right EV's for 5T2-5T6, just not 5TA, as you assumed that you must stand when the correct action is to hit. So, replace the EV for 5TA with the hit EV of 5TA after you compute the proper stand/hit EV's for all subsequent cards.

    Please see Ch 11 in ToBJ for details on the "Cascading Method" that Griffin talks about. Also, again, re-read my thread "Verifying Numbers" where Eric talks about Griffins method(s) you should take when computing the correct EV's for drawing.

    After you correct this logical error, you should be able to compute the correct EV's for a simple Stand/Hit strategy table for any given rules.

  9. #9


    Did you find this post helpful? Yes | No
    Hi, dogman
    Yes!! That's it!! I think I've got it! Thanks so much for hanging in there with me!!!!! I didn't understand the proper approach.
    I had incorrectly thought that the EV for hitting a 2-card hand is the same as the sum of the EVs for standing on every possible 3-card hand you could get by hitting.
    As you say, the problem with that approach is that the rules do not require you to stand after hitting a 2-card hand and, in some cases, you can improve your EV by hitting AGAIN. The 10,5,1 hand is one of those hands because, against a 9, the EV for hitting is a bit better than for standing.
    (So, that is what Griffin means by "cascading" because this can go on and on as you consider hands with different totals and different dealer up cards.)
    I will need to re-write my code to calculate and compare the EV for standing and for hitting on each hand.
    Continuing with the 10,5 vs. 9 scenario, if you hit and get either a 10 or a 9 or an 8 or a 7, those will all result in Busts. So, the EV for those hands is -1 unit and you can just take -1 times the probability of those cards coming up as the 'net' EV.
    For hitting and getting a 6, you will have a total of 21. If you hit again, you will bust for certain. So, the result from Hitting a 10,5,6 is always -1 unit while the EV from standing on a 10,5,6 vs. 9 is a whopping +0.9402. So, of course, you take the EV from standing as your net EV.
    But, for any hand <21, I need to compare the EV for standing vs. hitting to see which one is better and use the better EV in my overall EV calculation, as you carefully showed in your last post.
    Once I have all the optimal EVs for each situation, I can sum them to get the overall EV for hitting a 10,5 vs. 9.
    And, as you say, when I do the math on that, I get -0.475256 which matches with the online calculations!!!!!!!!!
    Again, thanks so much for all the help and sorry to be so slow! I'm new to combinatorics and doing this all on my own so it's a bit rough at this point...
    I will keep you posted on my progress and I hope that some readers out there were enlightened a bit by this thread because I sure didn't have it straight in my mind and, frankly, I've always had a lot of trouble understanding Griffin's book even though I am very curious about combinatorics.

    Thanks and best!
    SiMi

  10. #10


    Did you find this post helpful? Yes | No
    Quote Originally Posted by SiMi View Post
    Hi, dogman
    Yes!! That's it!! I think I've got it! Thanks so much for hanging in there with me!!!!! I didn't understand the proper approach.
    I had incorrectly thought that the EV for hitting a 2-card hand is the same as the sum of the EVs for standing on every possible 3-card hand you could get by hitting.
    As you say, the problem with that approach is that the rules do not require you to stand after hitting a 2-card hand and, in some cases, you can improve your EV by hitting AGAIN. The 10,5,1 hand is one of those hands because, against a 9, the EV for hitting is a bit better than for standing.
    (So, that is what Griffin means by "cascading" because this can go on and on as you consider hands with different totals and different dealer up cards.)
    I will need to re-write my code to calculate and compare the EV for standing and for hitting on each hand.
    What needs to be done is to correctly implement the hit algorithm. You must compute the hit EV's starting with all hard 21's down to an including hard 12's, then all soft 21's down, then a hard totals from 11 down, and finally, computing the pair cards.

    Doing this will allow you to find the optimal EV for each hand state.


    Continuing with the 10,5 vs. 9 scenario, if you hit and get either a 10 or a 9 or an 8 or a 7, those will all result in Busts. So, the EV for those hands is -1 unit and you can just take -1 times the probability of those cards coming up as the 'net' EV.
    For hitting and getting a 6, you will have a total of 21. If you hit again, you will bust for certain. So, the result from Hitting a 10,5,6 is always -1 unit while the EV from standing on a 10,5,6 vs. 9 is a whopping +0.9402. So, of course, you take the EV from standing as your net EV.
    But, for any hand <21, I need to compare the EV for standing vs. hitting to see which one is better and use the better EV in my overall EV calculation, as you carefully showed in your last post.
    Once I have all the optimal EVs for each situation, I can sum them to get the overall EV for hitting a 10,5 vs. 9.
    You get the general idea. One thing I would like to point out is that instead of re-computing previous EV's, consider only doing them once. The reason I say that is you may be tempted to re-compute the hit/stand EV's for 5TA even after you have done so. This will slow down your program as the CPU has few resources to continuosly brute force previously solved hand states. This is just a friendly reminder!

    And, as you say, when I do the math on that, I get -0.475256 which matches with the online calculations!!!!!!!!!
    Again, thanks so much for all the help and sorry to be so slow! I'm new to combinatorics and doing this all on my own so it's a bit rough at this point...
    I will keep you posted on my progress and I hope that some readers out there were enlightened a bit by this thread because I sure didn't have it straight in my mind and, frankly, I've always had a lot of trouble understanding Griffin's book even though I am very curious about combinatorics.

    Thanks and best!
    SiMi
    Sure.

    Also: don't think of Combinatorics as some n_th dimensional abstraction in the mathematical world. It can be thought of as the application of counting discrete structures and systems.

    https://en.wikipedia.org/wiki/Combinatorics

    Think of this project as a fancy algebra/arithmetic test. And the math in Griffin's book is gnarly at best, but the relevant text, where he goes over details under certain concepts, is where you will gain the most knowledge if math is not your strong suit.

  11. #11


    Did you find this post helpful? Yes | No
    Just an FYI, Cacarulo and I were the first to figure out the exact EV for finite splits together with some help from Kevin Smith who got us brute force calcs. Cacarulo's and I's numbers match exactly when we use the same strategy so there isn't necessarily a discrepancy but if you get different numbers you're looking at different strategies. For example he may be calculating a 2C strategy vs a TD one.

  12. #12


    Did you find this post helpful? Yes | No
    Quote Originally Posted by MGP View Post
    Just an FYI, Cacarulo and I were the first to figure out the exact EV for finite splits together with some help from Kevin Smith who got us brute force calcs. Cacarulo's and I's numbers match exactly when we use the same strategy so there isn't necessarily a discrepancy but if you get different numbers you're looking at different strategies. For example he may be calculating a 2C strategy vs a TD one.
    Interesting!

    So, looking at the 23 vs 7-A data, I get values that agree depending on the up card. For T/A, I get different values than you guys and you both agree with each other. For 7-9, I agree with MGP but not Cacarulo? Assuming 1D, S17, stand and hit EV's only on a full deck, EV's for T and A conditioned for no dealer natural. I wonder what is causing that?

    Who knows. Right now, I have a function that is being called 150 million times to compute probabilities. Takes up 98% of all processing in 22 seconds. Needs to be dealt with.

  13. #13


    Did you find this post helpful? Yes | No
    Odds are good you're either not setting the rules up correctly or not conditioning the A/T correctly. My code is available on Git. That should help you figure out the error.Not sure why any calc would take 150 million compuatations...Good luck
    Quote Originally Posted by dogman_1234 View Post
    Interesting!So, looking at the 23 vs 7-A data, I get values that agree depending on the up card. For T/A, I get different values than you guys and you both agree with each other. For 7-9, I agree with MGP but not Cacarulo? Assuming 1D, S17, stand and hit EV's only on a full deck, EV's for T and A conditioned for no dealer natural. I wonder what is causing that?Who knows. Right now, I have a function that is being called 150 million times to compute probabilities. Takes up 98% of all processing in 22 seconds. Needs to be dealt with.

Page 1 of 2 12 LastLast

Similar Threads

  1. Combinatorics Alalysis for blackjack basic strategy
    By lij45o6 in forum General Blackjack Forum
    Replies: 7
    Last Post: 07-13-2016, 08:45 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.