Blackjack and Card Counting Forums - BlackjackInfo.com


Go Back   Blackjack and Card Counting Forums - BlackjackInfo.com > Blackjack Forums > Blackjack - Theory and Math

Reply
 
Thread Tools Display Modes
  #1  
Old October 28th, 2009, 09:47 AM
ItsMe1989 ItsMe1989 is offline
Member
 
Join Date: Oct 2009
Posts: 7
Default 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
Reply With Quote
  #2  
Old October 28th, 2009, 10:08 AM
Sonny's Avatar
Sonny Sonny is offline
Moderator
 
Join Date: Mar 2006
Location: Los Angeles, CA
Posts: 3,967
Default

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!
Reply With Quote
  #3  
Old October 29th, 2009, 03:37 AM
ItsMe1989 ItsMe1989 is offline
Member
 
Join Date: Oct 2009
Posts: 7
Default

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.
Reply With Quote
  #4  
Old November 6th, 2009, 04:42 AM
ItsMe1989 ItsMe1989 is offline
Member
 
Join Date: Oct 2009
Posts: 7
Default

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.
Reply With Quote
  #5  
Old November 6th, 2009, 11:38 AM
Canceler's Avatar
Canceler Canceler is offline
Executive Member
 
Join Date: Apr 2005
Location: Minnesota
Posts: 1,289
Default

Quote:
Originally Posted by ItsMe1989 View Post
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.
Reply With Quote
  #6  
Old November 7th, 2009, 04:34 AM
ItsMe1989 ItsMe1989 is offline
Member
 
Join Date: Oct 2009
Posts: 7
Default

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.
Reply With Quote
  #7  
Old November 7th, 2009, 10:53 AM
KenSmith's Avatar
KenSmith KenSmith is offline
Administrator
 
Join Date: Mar 2005
Posts: 1,625
Default

Quote:
Originally Posted by ItsMe1989 View Post
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.
__________________
BlackjackInfo.com wallet-size blackjack basic strategy cards.

Blackjack Tournaments
Reply With Quote
  #8  
Old November 7th, 2009, 11:01 AM
ItsMe1989 ItsMe1989 is offline
Member
 
Join Date: Oct 2009
Posts: 7
Default

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.

Reply With Quote
  #9  
Old November 7th, 2009, 11:06 AM
Canceler's Avatar
Canceler Canceler is offline
Executive Member
 
Join Date: Apr 2005
Location: Minnesota
Posts: 1,289
Default

Quote:
Originally Posted by ItsMe1989 View Post
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.
Reply With Quote
  #10  
Old November 7th, 2009, 01:59 PM
KenSmith's Avatar
KenSmith KenSmith is offline
Administrator
 
Join Date: Mar 2005
Posts: 1,625
Default

Quote:
Originally Posted by ItsMe1989 View Post
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.
__________________
BlackjackInfo.com wallet-size blackjack basic strategy cards.

Blackjack Tournaments
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 03:37 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright 2005-2009 Bayview Strategies LLC