
|

October 28th, 2009, 09:47 AM
|
|
Member
|
|
Join Date: Oct 2009
Posts: 7
|
|
Calculate probability to decide whether to hit/double/split/stand
Hi,
I'm currently trying to build a Blackjack game and would like to be able to calculate what the best option to take in a given situation is.
I have used information at http://probability.infarom.ro/blackjack.html in order to calculate a probability of bettering your hand if you take another card but cannot find any equations explaining how to calculate the probability after taking actions such as split.
Something like http://www.tqsports.com/blackjack/calculator.htm is what i would like to make, but I cannot get my head around the calculations needed.
Thanks
|

October 28th, 2009, 10:08 AM
|
 |
Moderator
|
|
Join Date: Mar 2006
Location: Los Angeles, CA
Posts: 3,966
|
|
Basically you want to calculate the EV for every possible hand. It can be pretty tricky because the number of hands is large and the calculation of dealer probabilities is usually different for most hands. The Theory of Blackjack by Peter Griffin will explain how to derive BS for BJ, as well as give you the formulas and even some source code to calculate the numbers yourself. You might also like to read these old threads.
http://www.blackjackinfo.com/bb/showthread.php?t=7197
http://www.blackjackinfo.com/bb/showthread.php?p=37503
-Sonny-
__________________
It's not the size of your bankroll, it's how you leverage it!
|

October 29th, 2009, 03:37 AM
|
|
Member
|
|
Join Date: Oct 2009
Posts: 7
|
|
Thanks for your reply Sonny.
Thats looks like exactly what I want to do.
If The Theory of Blackjack by Peter Griffin explains how to calculate these numbers then I will buy it and proceed from there.
|

November 6th, 2009, 04:42 AM
|
|
Member
|
|
Join Date: Oct 2009
Posts: 7
|
|
Hi,
I've bought the book The Theory of Blackjack by Peter Griffin and have managed to work out and code a solution to calculate the probabilities for:
- Dealer outcome
- Stand EV
- Double EV
I'm having trouble working out how to go about the hit and split probabilites as i can't work out where the calculations should stop. Stand and double were ok as its either the current position, or one further card - but with hit and split there are many paths to go down of varying lengths.
When calculating the EV for hit presumably i am correct in thinking it should take more than just the next card into account? Otherwise it would surely be the same calculation as the double and wouldn't therefore take into account the option of taking further cards.
Any help or advice on how to programmatically (even at a pseudo-code level) do the hit and split calculations would be much appreciated.
Many thanks.
|

November 6th, 2009, 11:38 AM
|
 |
Executive Member
|
|
Join Date: Apr 2005
Location: Minnesota
Posts: 1,289
|
|
Quote:
Originally Posted by ItsMe1989
i can't work out where the calculations should stop.
|
To do it right, you should stop after you’ve taken into account EVERYTHING THAT COULD POSSIBLY HAPPEN, and weighted those outcomes by their probability of occurrence.
No one said it would be easy.
This is why I’m in awe of anyone who develops a combinatorial analyzer.
|

November 7th, 2009, 04:34 AM
|
|
Member
|
|
Join Date: Oct 2009
Posts: 7
|
|
Thanks Canceler. I wasn't expecting it to be easy!
Is there any way to get sufficient results quickly for the purposes of giving real time advice alongside a game, rather than completly accurate for all possibly actions.
Something i'm thinking is:
Take the hand, work out the EV of standing, work out ev of standing after hitting (for each card ace through tens), if hit is greater than stand then continue down the hit path (and do the same again) otherwise take the stand value. Weight them accordingly and add them up.
This seems to be giving realistic figures when compared to those of doubling and standing (ie. the advice seems to be correct) in all situations but those which you would clearly expect double to be favoured - in this case the hit figure is still higher.
Any comments on this way of calculating a basic figure for simple advice in a "just-for-fun" game? or ways which it could be improved?
Your comments are much appreciated. Thanks.
|

November 7th, 2009, 10:53 AM
|
 |
Administrator
|
|
Join Date: Mar 2005
Posts: 1,625
|
|
Quote:
Originally Posted by ItsMe1989
Is there any way to get sufficient results quickly for the purposes of giving real time advice alongside a game, rather than completly accurate for all possibly actions.
|
Except for splits, the complete calculation should be quick enough for realtime use.
Quote:
Something i'm thinking is:
Take the hand, work out the EV of standing, work out ev of standing after hitting (for each card ace through tens), if hit is greater than stand then continue down the hit path (and do the same again) otherwise take the stand value. Weight them accordingly and add them up.
|
On the right track, but you can't know the hit EV unless you go all the way to the end of the chain. Otherwise, you're essentially comparing "stand" to "hit just once", which is going to yield inaccurate results. For example, with a hard total of 5, the EV is identical for hitting once or standing. Hitting is obviously superior once you allow more than one hit card.
The code you write for this process should be recursive. The innermost routine should call itself many times to arrive at a result.
|

November 7th, 2009, 11:01 AM
|
|
Member
|
|
Join Date: Oct 2009
Posts: 7
|
|
Thanks for your reply KenSmith.
The code i have written is recursive, it keeps hitting until the current stand EV (after any number of hits) is greater than the EV after hitting the next card.
Can you explain to me what you mean by "the end of the chain"? As it is where the calculation should stop that I am unsure on.
|

November 7th, 2009, 11:06 AM
|
 |
Executive Member
|
|
Join Date: Apr 2005
Location: Minnesota
Posts: 1,289
|
|
Quote:
Originally Posted by ItsMe1989
Any comments on this way of calculating a basic figure for simple advice in a "just-for-fun" game? or ways which it could be improved?
|
No, not from me. I'm not qualified to advise you on this; I just know it's complicated. People like KenSmith, Sonny, and k_c can give you much better advice than I can.
|

November 7th, 2009, 01:59 PM
|
 |
Administrator
|
|
Join Date: Mar 2005
Posts: 1,625
|
|
Quote:
Originally Posted by ItsMe1989
Can you explain to me what you mean by "the end of the chain"? As it is where the calculation should stop that I am unsure on.
|
The end of the chain is when you have a total of 21 or more. For every possible hand combination, you'll examine all possible hits until the hand reaches 21 or busts.
Here's a bit of pseudo-code:
Code:
function GetOptimalValue(CurrHand);
{
Calculate StandEV;
if (CurrHand.total >= 21) {
return StandEV;
} else {
HitEV = 0;
for HitCard = (ace,2,3,...,Ten) {
ProbabilityThisCard = NumLeft(HitCard) / TotalCardsLeft;
NewHand = CurrHand.addCard(HitCard);
HitEV += ProbabilityThisCard * GetOptimalValue(NewHand);
}
if HitEV > StandEV {
return HitEV;
} else {
return StandEV;
}
}
I'm glossing over lots of details here, such as the fact that you need to send the current Deck status into the recursive routine. Hopefully this helps though.
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -6. The time now is 07:44 PM.
|