A small Java program that simulates blackjack hands under four fixed strategies (Always Hit, Always Stand, Always Double, Always Split) and reports how much of a starting bankroll each one ends with.
Made this out of curiosity about blackjack basic strategy, and wanting to see how a ruleset like "perfect" basic strategy actually gets worked out from simulation rather than taken on faith.
- Builds a shuffled shoe of a given number of decks.
- Deals a player and dealer hand from the shoe for each simulated round.
- Plays out the round according to whichever fixed strategy is being tested, no player decisions, the strategy is baked in.
- Has the dealer hit until reaching 17 or more, the standard house rule.
- Tracks the running bankroll across all simulated rounds for each strategy and prints the final totals.
Just a JDK (11+ is fine) on your PATH, no external dependencies or build tool. javac and java on Windows/Linux/Mac all work the same way here.
javac Blackjack.java
java Blackjack
It will prompt for the shoe size in decks and the number of simulations to run, then print the final bankroll for each of the four strategies.
Worked on in December 2024.