Blackjack Strategy Programs
Here are some programs to help develop and test Blackjack playing
strategies.
Program 1
This program prints a table showing when you should hit or stand
based on the up card that the dealer is showing.
The output from the program:
2 3 4 5 6 7 8 9 10 A
20: S S S S S S S S S S
19: S S S S S S S S S S
18: S S S S S S S S S S
17: S S S S S S S S S S
16: S S S S S H H H H H
15: S S S S S H H H H H
14: S S S S S H H H H H
13: S S S S S H H H H H
12: H H S S S H H H H H
The numbers across the top are the dealer's up card, and the numbers
in the left column are the total of the player's hand.
Click here for the source code to program 1.
Program 2
This is the same program, but it takes into account the removal from
the deck of the dealer's up card and the two cards in the player's hand.
Partial output from the program:
2 3 4 5 6 7 8 9 10 A
4,10: S S S S S H H H H H
5,9: S S S S S H H H H H
6,8: S S S S S H H H H H
7,7: S S S S S H H H S H
The numbers in the left column are the two cards in the player's hand.
This chart shows that you should stand when holding two sevens against
a ten.
Click here for the source code to program 2.
Program 3
But what about the possibility of splitting that pair of sevens?
The next program prints a table showing when you should split pairs.
The output from the program:
2 3 4 5 6 7 8 9 10 A
11,11: Sp Sp Sp Sp Sp Sp Sp Sp Sp Sp
10,10: S S S S S S S S S S
9,9: Sp Sp Sp Sp Sp S Sp Sp S S
8,8: Sp Sp Sp Sp Sp Sp Sp Sp H H
7,7: Sp Sp Sp Sp Sp Sp H H S H
6,6: Sp Sp Sp Sp Sp H H H H H
5,5: H H H H H H H H H H
4,4: H H H H H H H H H H
3,3: H H Sp Sp Sp Sp H H H H
2,2: H Sp Sp Sp Sp Sp H H H H
At this point, the program is starting to have problems. First, it
is very slow. This chart took over half an hour to print. Second,
it does not agree with the tables that I have seen in various books.
This may be because it does not take into account the fact that the
dealer has already checked for a dealer blackjack, and therefore
cannot have a ten under an ace, or an ace under a ten.
Click here for the source code to program 3.
Last update: 2-20-97