Thread Rating:

Sacke86
Sacke86
  • Threads: 7
  • Posts: 27
Joined: Aug 16, 2020
August 16th, 2020 at 8:35:45 AM permalink
Hello! I desperately need the source code of this calculator ( wizardofodds.com/games/blackjack/hand-calculator/ ), PHP to be more specific, or only the algorithm written in any other language or only matematical explanation to understand how it works because I can implement it by myself in C++ or something like that. I can only get the ml, .js, .css and the needed images but I can't get the p file. I'm decent at math but these blackjack algorithms are giving me headaches. So I need the source code to make some adjustments and change the numbers of cards dealt, my cards and dealer's upcard in real time easily while I'm playing live blackjack, for example. I would apreciate soo much if you can help me with this, I've registered to this forum especially for this problem. Thanks and have a nice day! :D
ThatDonGuy
ThatDonGuy
  • Threads: 117
  • Posts: 6218
Joined: Jun 22, 2011
August 16th, 2020 at 8:48:57 AM permalink
If you're playing online, why not just use the Wizard's calculator in another window?

If you're trying to develop one to use in a casino, what casino would let you? Certainly in Nevada, they are illegal (as are Video Poker hand analyzer apps).
Sacke86
Sacke86
  • Threads: 7
  • Posts: 27
Joined: Aug 16, 2020
August 16th, 2020 at 9:06:52 AM permalink
I'm wasting some time modifying all that numbers every time a card is dealt. I want to put a button wich decreases the remaining cards, for example if I push a button under 10 the number of 10s remaining should decrease from 128 to 127 (8 decks shoe). I don't wanna play in real casinos, I'm not even from America, I don't have near my town real casinos here in Romania and it's too expensive for me anyway. :)) Just low stakes in online live casinos. Edit: I need to include also a true count to help me change my bet according to the true count
charliepatrick
charliepatrick
  • Threads: 39
  • Posts: 2946
Joined: Jun 17, 2011
August 16th, 2020 at 11:18:31 AM permalink
I guess you could develop a web page (or other program) that keeps the count and allows you to press "buttons" as cards are dealt. The strategy does change, but it's probably easiest to look for the illustrious 18 and program these in - most the other time it's not worth worrying about being 100% correct (e.g. exactly which 16s 15s to hit) although I can understand that adds a small House Edge.

Of course if you're good at programming you could create the decision information dynamically, especially as you're only interested in the decision you're facing rather than everything (except you might need to know the House Edge has drifted in your favour). Splits will possibly be the worst to work out!

I don't play online but can appreciate that with a lot of effort you might find a perfect way to play. However I suspect some online casinos will be able to work you've been 100% correct if you start winning a lot and take a dim view. Also I believe some casinos shuffle after every hand as it's so easy for them to do so.
Sacke86
Sacke86
  • Threads: 7
  • Posts: 27
Joined: Aug 16, 2020
August 16th, 2020 at 12:50:45 PM permalink
That calculator shows you the best decision possible for every hand possible and every deck composition possible as I understood so a hand can't be played better than that. If you keep track of what cards was dealt, not just low cards 2 to 6 and high cards 10s and Aces but how much 2s,3s,4s....9s,10s,Aces was left, in combination with the true count and a good betting strategy according to the true count I think matematicaly you can't gain better chances of winning than this way. I just need the algorythm behind that calculator, wich I can't access because it's PHP (back-end). If I'm wrong, my bad, but this is what I think. A better scenario than this it's impossible.
charliepatrick
charliepatrick
  • Threads: 39
  • Posts: 2946
Joined: Jun 17, 2011
August 16th, 2020 at 1:13:59 PM permalink
It's a lot of work to program a deck composition strategy as you need to work through every possible player hand (actually cards not just its total) and then what is its correct strategy. This is recursive. It gets more complicated when you're looking at dealer's peeking and player splitting.

The basic idea is, for a given dealer's upcard, look at all the hands a player can get. Personally it seems easier to start with those with most cards (i.e. 21 Aces) and work down to zero. For each hand you work out what the dealer can get and hence the EV. Also look at all the hands you could get by drawing. Then you know whether you Hit, Stand or Double.

You consider the effects of peeking when looking at the relative chances of the next cards (e.g. sometimes you know something about the dealer's downcard).

Splitting is more complicated and in throey you cater for the fact that one of the split cards has been removed from the deck.


So that's the logic - simples.
gordonm888
Administrator
gordonm888
  • Threads: 60
  • Posts: 5001
Joined: Feb 18, 2015
Thanked by
charliepatrick
August 16th, 2020 at 1:28:55 PM permalink
I have worked with some friends and customers on BJ hand calculators like this (note: only for use on online games.) Here are my top-level comments.

1. IMO, BJ calculators for optimized play (and betting) need to be customized for a specific game: rules, number of decks and shoe penetration. The differences between single deck vs 8 decks, S17 vs H17, No peek (ENHC) vs peek, doubling and splitting options, etc. have lots of implications and writing an "optimum play" calculator for all rules, all shoe sizes and all penetrations is a monumental task and make the calculator complicated and unwieldy.


2. Much of the edge from optimal play comes from Insurance and 16vT. A standard "bet size"count does an inefficient job with insurance and is deeply flawed for 16vsT (because it counts the removal of a 6 as increasing the motivation to stand when instead it has a very strong influence in the opposite direction. (Also note that games with the surrender rule greatly reduce the opportunity to gain EV from 16 v T).

A count for bet size variation is often not a good way to capture the EV from the swings in card composition because for many of the other "close-call decisions" it is the relative abundance of, say, 9's or 7's that matter, or the abundance of Aces, or the abundance of 2's and 3's vs 4-9. In fact the so-called "illustrious 18" do not include some hands that are legitimate opportunities for optimized decisions because the Hi-LO/Hi-OPT counts are completely useless for providing guidance.

3. Having said all that, composition-dependent optimized decisions can be significant in single and double deck games but (other than insurance and 16vT) not going to make a significant difference in 6-8 deck games. But like a lot of people, I like to fight for every increment of edge I can get.

4. User interfaces for input and output are always important. There are people in the world who write 'robots' that can recognize objects such as cards on screens and, combined with game-specific code, can play on-line poker or online video games. I know almost nothing about the programming or use/problems of such 'robots' but they might be ideal for minimizing manual data entry for your intended application.

5. Anyone who has written source code for a BJ hand calculator has either invested a lot of their personal time or paid a professional programmer to do so. I believe the WOO site owner (at the time) paid a professional programmer to write the source code that you are requesting.

So please understand that it may be a bit much to expect that someone is going to give you a source code simply because you "really want it."

6. Here are two recent threads on the subject.

blackjack-2021-real-time-analyzer

blackjack-house-edge-calculator-for-depleted-shoe
So many better men, a few of them friends, are dead. And a thousand thousand slimy things live on, and so do I.
Sacke86
Sacke86
  • Threads: 7
  • Posts: 27
Joined: Aug 16, 2020
August 17th, 2020 at 8:43:48 AM permalink
I've done a program in C++ in the past but it was running very slow and it couldn't be used when playing in real time because I used combinations with 5 possible next cards for dealer from the remaining cards in the deck and this is more than enough because there are small chances for the dealer to draw more than 5 cards before busting or standing, even with 8 decks shoe. For the player it's simple because you only need to know the next card and you have a percentage for taking any card so you should know your chances of getting bust or not if you hit or double that hand. I can't explain that good because english it's not my native language but with my math understanding I think this method should be pretty good. I am just curious about that calculator because it calculates instantly what action you should take and I don't know if it is better than my a few months old program or not. Anyway, I will try to update that program and I will see if it is similar with that online calculator.
charliepatrick
charliepatrick
  • Threads: 39
  • Posts: 2946
Joined: Jun 17, 2011
August 17th, 2020 at 8:50:05 AM permalink
Normally you'll be looking at borderline cases, e.g. do you hit 16 vs dealer; however doubles/splits are slightly more complicated.

If you consider an example, do you double 9 vs 2, then it's no good just looking at the next card. If the next card is a 2 (or 3) you're probably going to hit if you don't double. Similarly doubling 10 vs 9 needs to looks at all ways you get to 16 or 17, and then how the dealer does (which actually is easier since there are fewer cards the dealer might use).
Last edited by: charliepatrick on Aug 17, 2020
gordonm888
Administrator
gordonm888
  • Threads: 60
  • Posts: 5001
Joined: Feb 18, 2015
August 17th, 2020 at 9:52:21 AM permalink
The Wizard of Odds blackjack hand calculator is generally regarded as being exact as is the blackjack hand calculator at BJStrat.com. I trust them both.

And charliepatrick is correct. You generally need to be able to draw at least 5 cards for the dealer and as many as necessary for the player to discriminate between the options on some close-call hands.
So many better men, a few of them friends, are dead. And a thousand thousand slimy things live on, and so do I.
Justoungiro
Justoungiro
  • Threads: 0
  • Posts: 1
Joined: Aug 10, 2023
August 10th, 2023 at 5:08:46 AM permalink
Quote: Sacke86

Hello! I desperately need the source code of this calculator ( /games/blackjack/hand-calculator/ ), PHP to be more specific, or only the algorithm written in any other language or only matematical explanation to understand how it works because I can implement it by myself in C++ or something like that. I can only get the ml, .js, .css and the needed images but I can't get the p file. I'm decent at math but these blackjack algorithms are giving me headaches. So I need the source code to make some adjustments and change the numbers of cards dealt, my cards and dealer's upcard in real time easily while I'm playing live blackjack, for example. I would apreciate soo much if you can help me with this, I've registered to this forum especially for this problem. Thanks and have a nice day! :D
link to original post



Hey! I am looking since a couple of weeks for the exactly same file. Did you manage to get it?

By the way, a little bit of automation can be set by using the link call that looks something like:

where each 32 is the number of card x in the deck.
  • Jump to: