I’d like to try to copy the logic into Python for simulation purposes.
I’ve seen a JavaScript script when looking at ‘View Page Source’ on the site, but it points to Ajax which I think means the actual calculations are done on the site server.
Does anyone know how it works? Monte Carlo simulation seems unlikely since it’s so fast and the numbers don’t change for the same hand down to six decimal places, so I assume there’s a lookup table, which I would also be interested in acquiring.
Any help would be greatly appreciated!
Quote: overthehedgeI have been using the hand calculator from the wizard of odds site and have been wondering if I could access the program used to make the calculations.
I’d like to try to copy the logic into Python for simulation purposes.
I’ve seen a JavaScript script when looking at ‘View Page Source’ on the site, but it points to Ajax which I think means the actual calculations are done on the site server.
Does anyone know how it works? Monte Carlo simulation seems unlikely since it’s so fast and the numbers don’t change for the same hand down to six decimal places, so I assume there’s a lookup table, which I would also be interested in acquiring.
Any help would be greatly appreciated!
link to original post
I wrote a program to do the same calculation. It's pretty fast even though it's in Visual Basic on my laptop. For hitting, I use a loop from 1 to 10 (1=ace), and have the subroutine call itself until it runs out of cards of that rank or there is no need to hit again (e.g. dealer total reaches 17 or the player totals 21 or more). There is no lookup table because there are billions of possible combinations.
Start with the player standing
Go through every possible deal of cards for the dealer - for example, if the dealer is showing a 7:
7, Ace - dealer stands on 18
7, 2 - dealer has 9, so check each card value from Ace through 10:
7, 2, A - dealer stands on (soft) 20
7, 2, 2 - dealer has 11, so check each card value from Ace through 10 {...}
7, 2, 3 - dealer has 12, so check each card value from Ace through 10 (hint: 7, 2, 3, 9 is 21; 7, 2, 3, 10 is a dealer bust on 22)
...
7, 2, 10 - dealer stands on 19
7, 3 - dealer has 10, so check each card value from Ace through 10 {...}
...
7, 10 - dealer stands on 17
Now, have the player hit - check every card value from Ace through 10, and remember to check for splits if the second card is a 7
Quote: overthehedgeI have been using the hand calculator from the wizard of odds site and have been wondering if I could access the program used to make the calculations. <snip>
link to original post
overthehedge,
Eric Farmer, a well-respected blackjack analyst, has posted the code for his various Blackjack programs at github:
https://github.com/possibly-wrong/blackjack
In particular, his Basic Strategy Calculator (strategy.exe) allows the user to input the dealer's upcard and the player's cards and then it shows the EV for each possible play.
I have used his programs for many years with great success.
Hope this helps!
Dog Hand