A portfolio-grade Blackjack Engine project built with Java and JavaFX. It separates core game rules, strategy analysis, recommendation analytics, session persistence, and the desktop UI so the engine remains reusable and easy to extend.
This project is designed around the following goals:
- A reusable blackjack engine with game rules separated from UI code
- Real gameplay flow with
Hit,Stand,Double, andSplit - Strategy analysis with
Best Move,Expected EV,Bust Risk, andDealer Bust Chance - Recommendation-following analytics
- A premium JavaFX table UI built with FXML and CSS
- Session save/load and statistics export
- Single-player vs dealer blackjack
- Fresh 52-card deck creation and shuffle at the start of each round
- Immediate natural blackjack detection
Hit / Stand / Double Down / Split- Sequential play for split hands
- Real-time strategy analysis panel
Best MoveReasonConfidenceExpected EVBust RiskDealer Bust Chance
- Recommendation analytics
- Session statistics
- wins / losses / pushes
- blackjacks
- split / double down usage
- recommendation accuracy
- session profit/loss
- best win streak
- Session save / load / statistics JSON export
- Card dealing animation, dealer hidden-card reveal, and chip animation
Main layers:
- Engine layer:
src/main/java/com/blackjackengine - UI layer:
src/main/java/com/blackjackengine/ui - FXML / CSS / card resources:
src/main/resources - Technical documents:
docs
Core responsibilities:
Card,Deck,Hand: card modeling and score calculationPlayer,Dealer,PlayerHand: participant and hand stateGameEngine: round lifecycle, betting, branching, settlementStrategyAdvisor: rule-based recommendations and EV / risk calculationsRecommendationAnalytics: follow-vs-ignore recommendation trackingGameStatistics: session statistics aggregationSessionPersistence: save / restore / exportBlackjackController: JavaFX UI synchronization and animation orchestrationCardImageMapper: card PNG loading and safe fallback handling
blackjack-engine-java
|-- README.md
|-- README.ko.md
|-- README.ja.md
|-- run.ps1
|-- run-ui.ps1
|-- docs
| |-- premium-javafx-blackjack-engine-whitepaper.pdf
| |-- premium-javafx-blackjack-engine-whitepaper-ko.pdf
| |-- blackjack-engine-algorithm-design.html
| `-- blackjack-engine-algorithm-design-ko.html
|-- src
| `-- main
| |-- java
| | `-- com
| | `-- blackjackengine
| | |-- Card.java
| | |-- Deck.java
| | |-- Hand.java
| | |-- Player.java
| | |-- Dealer.java
| | |-- PlayerHand.java
| | |-- GameEngine.java
| | |-- StrategyAdvisor.java
| | |-- RecommendationAnalytics.java
| | |-- SessionPersistence.java
| | `-- ...
| `-- resources
| |-- cards
| |-- ui
| | |-- blackjack-table.fxml
| | |-- start-screen.fxml
| | `-- blackjack.css
| `-- ui-assets
From PowerShell in the project root:
.\run.ps1From PowerShell in the project root:
.\run-ui.ps1On the first UI run, run-ui.ps1 downloads the required JavaFX runtime jars into .javafx-cache/
because standard JDK builds typically do not bundle JavaFX.
.\run-ui.ps1 -CompileOnly$outDir = Join-Path $PWD "out"
if (-not (Test-Path $outDir)) {
New-Item -ItemType Directory -Path $outDir | Out-Null
}
$sources = Get-ChildItem -Path .\src\main\java -Recurse -Filter *.java |
Select-Object -ExpandProperty FullName
javac -d $outDir $sources
java -cp $outDir com.blackjackengine.MainThe docs folder includes technical whitepapers for the project:
- English PDF:
docs/premium-javafx-blackjack-engine-whitepaper.pdf - Korean PDF:
docs/premium-javafx-blackjack-engine-whitepaper-ko.pdf - English HTML source:
docs/blackjack-engine-algorithm-design.html - Korean HTML source:
docs/blackjack-engine-algorithm-design-ko.html
- Starting chips can be entered on the start screen.
- Each round uses a fresh deck.
- Natural blackjack currently pays even money, not 3:2.
- The current implementation allows one split per round.
- The dealer stops drawing at
score >= 17. - The strategy system is rule-based and heuristic-driven, not Monte Carlo-based.
This repository does not currently include a separate external release pipeline. For a practical “ready to distribute” check, use:
- up-to-date
README.md,README.ko.md, andREADME.ja.md - current
docsartifacts .\run-ui.ps1 -CompileOnlyto verify compilation.\run-ui.ps1to verify the desktop UI directly when needed
- Monte Carlo EV mode
- Reinforcement learning strategy mode
- Multi-player table support
- Online leaderboard
- Probability heatmap visualization
- Mobile client