A Blackjack solver. The player's full hand composition is considered, not only the total sum.
- Deck (default: standard single deck)
- Blackjack amount (default:
$B=21$ ) - Dealer's target (or lowest amount to stand on) (default:
$T=17$ ). - Ace alternate extra value. Base value is 1. (default: 10)
The dealer always stands on reaching soft target
- Add double down
- Add split
- Add option for dealer to peek for blackjack
- Add option for dealer to hit when reaching soft target
The steps to determine an optimal policy using dynamic programming:
-
List all valid hands (all hands that have not busted), including empty and 1-card hands.
-
Find the probability
$D_s(h, c, t)$ that the dealer will stand at$t = T,...,B$ , for each player hand$h$ and each revealed dealer card$c$ . -
The EV (expected value) of standing at state
$(h, d)$ is
where
- The optimal policy/value for each state
$(h, c)$ can be determined in one sweep of all states going backwards from the largest hand size states to the lowest.
For base parameters: