Blackjack Strategy Optimization

Rene Plowden
Joseph Libby
Improving the profit
margin by optimizing
the win ratio through
the use of various
strategies and
algorithmic
computations.





Dealt from “shoe” of cards consisting of 1 deck.
One Player vs. Dealer
Player and Dealer each start with two cards.
Dealers 2nd card is unknown until player
actions are complete
The player has 2 legal moves in our
implementation:



Hit – draw one card
Stand – end their turn
The player’s goal is to have a card total higher
than the dealer, without exceeding 21.
11
𝑓 ℎ𝑎𝑛𝑑 =
𝑑 < 𝑝 < 22
𝑛=2
d = dealer total
 n = number of cards
 p = player total

11
𝑓 𝑑 =
16 < 𝑑 < 22
𝑛=2
d = dealer total
 n = number of cards

2
𝑥 = 21 , 𝑥1 = 10, 𝑥2 = 11
𝑛=2




n = number of cards
x = player card value
If the player or dealer has blackjack, they
win outright. If both the dealer and player
have blackjack, the hand is a draw
Player receive a 1.5:1 to return when they
draw blackjack, if they lose they simply
lose their bet.
Initial
Deal
None
Check
Blackjack
(t<22) Hit
Absorb
State
Stand
Player
Turn
(t>21) Hit
Dealer
Turn
Bust
State
(t>21) Hit
Player
Win
*(>17) Hit
Compare
Hands
Push
Dealer
Win
* Must do
>1 Blackjack
t = Hand Total





250,000 “shuffled” decks that each class will
use as well
Each deck is used for 4 games only
The player has the highest valued hand by
knowing the card before it is dealt.
Never takes into account the dealer’s cards.
Will be the highest winning ratio for each of the
tested algorithms.
Perfect Game
Perfect Game
600000
600000
500000
500000
400000
400000
300000
300000
200000
200000
100000
100000
0
0
Win
Lost
Push
Hand 1
Hand 2
Hand 3
Hand 4

Naïve Approach


Monte Carlo


Uses card counting to calculate chance of busting
when taking a hit.
Simulates 1000 variations of hand outcomes for each
possible decision (hit or stand), chooses the most
successful decision.
Combinatorial Analysis

Observes the probability of the state of the dealer’s
hand and the chance of the player busting when
taking a hit (using card counting as well).

Bases the player’s decision on the probability of a
successful hit.
successfulHit= (safeCards/remainingCards) * 100

Observes player wins, losses, and pushes over 1,000,000
hands for each targetPercentage in the set T:
T: {0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}
If successfulHit < targetPercentage:
Hit
Else:
Stand
900000
600000
800000
500000
700000
600000
400000
500000
loss
400000
win
hand 1
300000
hand 2
hand 3
push
300000
hand 4
200000
200000
0
10
20
30
40
50
60
70
80
90
100
0
0
0
10
20
30
40
50
60
70
80
90
100
100000
100000
Not Scaled evenly due to heavy losses from outcomes!!!






Making certain the uncertain.
Convert models of an outcome into varied
lengths used to simulate possible results.
The closer the lengths are to the true conclusion
probability the more viable the prediction.
More weighted heuristics will give the problem
more conclusive data.
Randomly choose a number along the number
line and record how many times it occurs.
Some answers will surface to the top.



Method 1 : Given that the current state is not in
the absorbing state use the 1000 guesses or
combinations to find out how many go past the
first hit. Used greater than .55
Method 2: Given that the current state is not an
absorbing state calculate the amount of times
won. Used greater than .5
Method 3: Given that the current state is not an
absorbing state calculate the amount of times
won without a hit and with a hit. Use the
higher of the two values.
600000
600000
500000
500000
400000
400000
Win
300000
Lost
Hand 1
300000
Hand 2
Hand 3
Push
200000
200000
100000
100000
0
0
Method 1 Method 2 Method 3
Hand 4
Method 1 Method 2 Method 3

Observes the distribution of all possible dealer end-states, given
the dealer’s “up-card”.
 Enumerates each end state with a probability, which is then incremented to one of
seven state variables:
 {state17, state18, state19, state20, state21, blackjack, bust}
 Implements stack which holds the game state to allow backtracking upon
reaching a leaf.


Calculates the probability of the player losing when standing.
(standLoss)
Calculates the probability of the player losing when taking a hit
(busting). (hitLoss)
If standLoss > hitLoss :
Hit
Else:
Stand

Calculates the probability of the player losing
when standing.

Sums the probability of non-bust dealer end-states
that have a higher total than the player’s hand.
 Ex 1. Given the player hand [Kh, 6s] (Total: 16)
 standLoss = state17+state18+state19+state20+state21
 Ex 2. Given the player hand [Kh, 8s] (Total: 18)
 standLoss = state19+state20+state21

Calculates the probability of the player losing
when taking a hit (busting).

Counts number of cards that will cause player’s
hand to exceed 21 (bustCards).

Counts remaining cards in deck.
hitLoss = bustCards/remainingCards
1 Mil
1 Mil
600000
600000
500000
500000
400000
400000
300000
300000
200000
200000
100000
100000
0
0
Win
Lost
Push
Hand 1
Hand 2
Hand 3
Hand 4
Wins
600000
500000
400000
300000
200000
100000
0
Wins




Integrate more heuristics and weights to
increase win ratio.
Incorporate more than one algorithm in the
decision making process.
Understand Monte Carlo better and how to
program implementation into a “chaotic”
environment.
Add splits and double down to the calculations
to see if it gets better results for the player.




We learned a lot about the algorithms we did
implement. Including a few we didn’t.
Found it more difficult to explain easy terms
rather than harder ones.
Complex problems and even more complex
solutions.
I learned again why I never bet.

Why is Monte Carlo methods used primarily in
‘predicting’ the Stock Market?


Although unpredictable, the Stock Market has a lot
of historical data and regular data that can be
measured to offer a solution to an unsolvable
prediction.
2. What data structure would best suit a back
tracking algorithm?

Stack
What is an absorbing state?
 A final state, defined by constraints, which cannot
transition to another state



https://math.dartmouth.edu/theses/undergra
d/2014/Vaidyanathan-Thesis.pdf
The Evolution of Blackjack Strategies
by Graham Kendall and Craig Smith
Evolving Strategies in Blackjack
by David Fogel