Difficulty Grading
Grading solitaire deals is trickier than it looks: a deal that feels "hard" in FreeCell is very different from a "hard" deal in 4-suit Spider, and an impossible deal isn't "hard" — it's just unsolvable.
Dealbreaker separates grading into two clear levels:
- Per-deal difficulty (
easy/medium/hard) — relative to that game, so every game can offer balanced Easy, Medium, and Hard deals. - Overall game difficulty (
easy/medium/hard) — absolute across games, so you can still tell at a glance that FreeCell is much more forgiving than 4-suit Spider.
Solvability Comes First
Before any deal is graded, Dealbreaker runs solve:
| Verdict | DealGrade / JSON status | Has difficulty? |
|---|---|---|
| Proven solvable | Solvable ("solvable") | Yes (easy, medium, or hard) |
| Proven impossible | Unsolvable ("unsolvable") | No |
| Budget or timeout hit | Unknown ("unknown") | No |
Unsolvable and budget-exhausted deals never carry a difficulty field — neither in Rust types nor in JSON output. A deal that ran out of search budget might actually be unsolvable, so it is never labeled hard.
How a Solvable Deal Is Scored
Each solved deal receives a continuous difficulty score from 0.0 (easiest) to 1.0 (hardest), built from two complementary signals:
- Simulated-player forgivingness (75%) — Dealbreaker plays the deal
playoutstimes (default24) using a fast, non-peeking heuristic player with modest human-scale lookahead (a small 400-state budget per playout and slight move-ordering variation):- It never peeks at face-down cards.
- If this simulated player wins most of the time, the deal is genuinely forgiving.
- If it rarely or never wins — even though
solveproved a win exists — the deal requires deep lookahead, tight sequencing, or non-obvious moves.
- Solver effort (25%) — Log-scaled
statesvisited bysolve(log10(states) / 6, clamped to0.0..=1.0). This cleanly breaks ties when playouts saturate at0%(very tight puzzle games) or100%(very loose games).
score = 0.75 * (1.0 - playout_win_rate) + 0.25 * effort(states)Playouts are seeded deterministically, so grading the same deal with the same options always produces the same result. Setting playouts to 0 skips playouts and grades purely from solver effort.
Relative Per-Game Buckets (Offline Curation)
When grading a batch of deals (grade_batch in Rust, or dealbreaker grade <GAME> --seeds A..B on the CLI):
- All
unsolvableandunknowndeals are set aside. - Solved deals are sorted by
scoreand split into thirds using empirical terciles (easy_maxat the 33rd percentile,medium_maxat the 67th percentile). - Those cutoffs are returned in
summary.cutoffs, so you can reuse them later with--cutoffs E,M(orGradeOptions::cutoffs) to classify individual new deals on the exact same scale.
If a game has almost no score variation across solvable deals, Dealbreaker falls back to fixed default cutoffs (0.35 / 0.65) instead of forcing nearly identical deals into artificial Easy/Medium/Hard buckets.
Overall Game Difficulty
From the exact same batch run, Dealbreaker summarizes how hard the game itself is across the catalog:
- Solvability rate (
solved / deals, plus an upper bound(solved + unknown) / dealswhen any deals hit the budget). - Estimated random-deal win rate (
overall_win_rate = solvability_rate * mean_playout_win_rate). - Overall
game_score(0.0..=1.0): blends1.0 - overall_win_rate(80%) with median solver effort (20%), mapped toeasy(<= 0.55),medium(<= 0.78), orhard(> 0.78).
Using both solvability and playout win rate matters: 4-suit Spider is often solvable with omniscient search, yet tactically punishing for a human — its low playout win rate ensures it is rated hard rather than easy.
For example, across 30 deals (--max-states 200000 --playouts 24):
| Game | game_difficulty | game_score | Est. Win Rate | Per-Deal Cutoffs |
|---|---|---|---|---|
| Spider (1 suit) | easy | 0.43 | 59% | 0.32 / 0.49 |
| FreeCell | easy | 0.51 | 48% | 0.41 / 0.64 |
| Klondike | medium | 0.68 | 27% | 0.54 / 0.89 |
| Baker's Dozen | medium | 0.71 | 29% | 0.59 / 0.81 |
| Klondike (draw 3) | hard | 0.83 | 10% | 0.85 / 0.90 |
| Forty Thieves | hard | 0.93 | 1% | 0.89 / 0.92 |
| Spider (4 suit) | hard | 0.97 | 0% | 0.96 / 0.96 |
Quick Usage
CLI
# Curate and grade a batch of deals (summary + per-deal JSON)
dealbreaker grade klondike --seeds 1..200 --max-states 200000 --json
# Grade a single deal using cutoffs saved from a batch
dealbreaker grade klondike --seed 42 --cutoffs 0.54,0.89 --json
# An unsolvable deal returns status="unsolvable" with no difficulty
dealbreaker grade freecell --ms 11982 --jsonRust
use dealbreaker::{grade_batch, presets, DealGrade, Game, GradeOptions};
let game = Game::new(presets::freecell()).unwrap();
let deals: Vec<_> = (1..=100).map(|seed| game.deal(seed)).collect();
let batch = grade_batch(&game, &deals, &GradeOptions::default());
println!(
"game={} ({:.2}), solved={}/{}",
batch.summary.game_difficulty.unwrap(),
batch.summary.game_score,
batch.summary.solved,
batch.summary.deals,
);
for (i, result) in batch.deals.iter().enumerate() {
match result {
DealGrade::Solvable { difficulty, metrics } => {
println!("seed {}: {difficulty} (score {:.2})", i + 1, metrics.score);
}
DealGrade::Unsolvable { .. } => println!("seed {}: unsolvable", i + 1),
DealGrade::Unknown { .. } => println!("seed {}: unknown", i + 1),
_ => {}
}
}