This project implements a Monte Carlo simulation of Blackjack to compare different playing strategies. It was developed as part of a university programming and simulation project.
The goal is to evaluate how simple heuristics perform compared to a simplified version of Blackjack Basic Strategy.
- Complete Blackjack game engine (player vs dealer)
- Infinite deck (sampling with replacement)
- Multiple strategies implemented
- Monte Carlo simulation with configurable number of games
- Statistical evaluation of results
- Visual analysis using diagrams and histograms
- RandomPolicy – Player randomly decides to hit or stand
- ThresholdPolicy (17) – Player hits until total ≥ 17
- ThresholdPolicy (16) – Player hits until total ≥ 16
- BasicStrategyPolicy – Simplified Blackjack Basic Strategy (no splits, no double down)
- Infinite deck (no card counting)
- Dealer stands on soft 17 (S17)
- Blackjack payout: 3:2
- Fixed bet per round
- No splits, no double down, no surrender
Simtools-Project/
main.py: Blackjack simulation and game logicdiagram.py: Strategy comparison diagramshistogram.py: Histogram visualizationsdiagram_outcome_rates.pngdiagram_average_profit.png
README.md
pip install -r requirements.txt
python main.py
python diagram.py
python histogram.pyThe diagrams show that:
- Random strategies perform worst
- Threshold strategies improve results slightly
- The Basic Strategy significantly reduces losses
Monte Carlo simulation is used to approximate expected outcomes by simulating a large number of independent games.
The simulation demonstrates that:
- Simple heuristics already outperform random play
- A structured rule-based strategy (Basic Strategy) performs best
- Temirlan Anarkulov
- Christian Heusler
This project is for educational purposes only.

