Blackjack is the most popular casino game in the world.

Using a basic strategy, a knowledgeable player can reduce the casino's advantage to less than one-half of one percent.

Simulating blackjack play with this strategy in MATLAB is both an instructive programming exercise and a useful parallel computing benchmark.

Blackjack is also known as "21." The object is to get a hand with a value close to, but not more than, 21. Your cards are dealt face up; one of the dealer's cards stays face down. When you are satisfied with your hand, you "stand." The dealer then reveals the hidden card and finishes the hand.

Face cards are worth 10 points, aces are worth either 1 or 11, and all other cards are worth their numerical value. If your total ever exceeds 21, you are "bust," and the dealer wins the hand without drawing any more cards.

The dealer has no choices to make, and must draw on hands worth less than 17 and stand on hands worth 17 or more.

(A variant has the dealer draw to a "soft" 17, which is a hand with an ace counting 11.) If neither player goes bust, then the hand closest to 21 wins. The fact that you can bust before the dealer takes any cards is a disadvantage that would be overwhelming were it not for three additional features of the game.