Monte Carlo simulation of blackjack with Basic Strategy, Hi-Lo card counting, and Random play — run up to 1 000 000 hands and watch the house edge converge.
Basic Strategy reduces the house edge to 0.5 % in a 6-deck S17/DAS game — the lowest achievable without counting cards. Hi-Lo assigns +1 to low cards (2–6) and −1 to high cards (10–A); a high true count means more 10s remain, so the counter raises bets. The house edge can flip negative (player advantage) at true counts above +3, explaining why casinos restrict bet spreads and shuffle early.
Select a strategy (Basic, Hi-Lo, or Random), set deck count and penetration, then click Play. The net-units chart shows cumulative profit/loss per hand. The house-edge chart converges toward the true EV as sample size grows — notice how variance dominates early and the line stabilises after ~10 000 hands. The strategy reference table at the bottom shows the optimal move for every player hand vs dealer upcard.
Edward Thorp published "Beat the Dealer" in 1962, proving mathematically that card counting gives a player edge. Casinos responded by adding decks, cutting early, and banning known counters. The MIT Blackjack Team operated from 1979–2000, reportedly winning millions using team-based counting disguised as large-group play — their story inspired the film "21" (2008). Modern casino surveillance uses facial recognition to flag known advantage players before they even sit down.
This Monte Carlo simulator deals up to one million blackjack hands and tracks the long-run expected value of three playstyles. It builds a randomised shoe of one to eight 52-card decks (Fisher-Yates shuffle), then plays hands under fixed S17/DAS rules with a 3:2 blackjack payout. The house edge is estimated empirically as the negative of net units divided by total amount wagered, so the percentage converges on the true edge as the sample grows.
The controls let you pick a strategy (Basic, Hi-Lo counting, or Random), deck count, hands to run, deck penetration, bet spread, and simulation speed. Hi-Lo assigns +1 to cards 2-6 and -1 to 10s and Aces, scaling bets by the true count (running count divided by remaining decks). The simulation matters because it shows, with real statistics, why disciplined basic strategy and counting beat intuition at the casino table.
What does this simulator actually compute?
It runs a Monte Carlo experiment: thousands to millions of blackjack hands are dealt and resolved automatically, and the resulting net units and house edge are tracked live. Because each hand is independent and randomly dealt, averaging over a large sample reveals the true long-run expectation of the chosen strategy.
How is the house edge calculated?
The edge is estimated as the negative of cumulative net units divided by total amount wagered, expressed as a percentage. With perfect basic strategy in a 6-deck S17/DAS game it settles around 0.5%, meaning the player loses roughly half a unit per 100 units bet over the long run.
What do the three strategy options do?
Basic Strategy plays the mathematically optimal move from a lookup table for every hand versus dealer upcard. Hi-Lo adds card counting and raises bets when the true count is favourable. Random simply hits or stands at 50/50 to show how badly an uninformed player fares.
Each card seen adjusts a running count: +1 for cards 2 through 6, -1 for 10s, face cards and Aces, and 0 for 7, 8 and 9. The running count is divided by the estimated remaining decks to get the true count, and the bet rises from one unit up to the chosen spread when the count is high.
Early on the sample is tiny, so variance dominates and the estimated edge swings widely. As hands accumulate the law of large numbers takes over and the line stabilises, typically settling close to the true value after around ten thousand hands.
Penetration is how deep into the shoe the dealer plays before reshuffling, set here between 50% and 90%. Deeper penetration helps card counters because more of the shoe is seen, making the true count more reliable; casinos limit penetration precisely to blunt this advantage.
Yes. With Hi-Lo counting and a wide bet spread, the empirical edge can turn negative (a player advantage) because high true counts mean more 10s and Aces remain, favouring the player through more blackjacks and stronger doubles. This is why casinos restrict spreads and shuffle early.
The engine uses common casino rules: dealer stands on all 17s (S17), doubling after splitting is allowed (DAS), blackjack pays 3:2, and surrender is disabled. The basic strategy table is tuned for a multi-deck S17/DAS game, so results reflect a realistic Las Vegas style table.
EV per hand is the average units won or lost across every hand played, shown as net units divided by hands. A small negative number, such as -0.005, reflects the house edge in action; counting strategies push this figure toward zero or slightly positive over a large sample.
Blackjack has an enormous number of branching outcomes from splits, doubles, and dealer draws, which makes a closed-form expectation hard to write down. Random simulation sidesteps the combinatorics: deal enough hands and the average outcome reliably approximates the exact mathematical expectation.