Skip to content

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:

  1. Per-deal difficulty (easy / medium / hard) — relative to that game, so every game can offer balanced Easy, Medium, and Hard deals.
  2. 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:

VerdictDealGrade / JSON statusHas difficulty?
Proven solvableSolvable ("solvable")Yes (easy, medium, or hard)
Proven impossibleUnsolvable ("unsolvable")No
Budget or timeout hitUnknown ("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:

  1. Simulated-player forgivingness (75%) — Dealbreaker plays the deal playouts times (default 24) 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 solve proved a win exists — the deal requires deep lookahead, tight sequencing, or non-obvious moves.
  2. Solver effort (25%) — Log-scaled states visited by solve (log10(states) / 6, clamped to 0.0..=1.0). This cleanly breaks ties when playouts saturate at 0% (very tight puzzle games) or 100% (very loose games).
text
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):

  1. All unsolvable and unknown deals are set aside.
  2. Solved deals are sorted by score and split into thirds using empirical terciles (easy_max at the 33rd percentile, medium_max at the 67th percentile).
  3. Those cutoffs are returned in summary.cutoffs, so you can reuse them later with --cutoffs E,M (or GradeOptions::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) / deals when 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): blends 1.0 - overall_win_rate (80%) with median solver effort (20%), mapped to easy (<= 0.55), medium (<= 0.78), or hard (> 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):

Gamegame_difficultygame_scoreEst. Win RatePer-Deal Cutoffs
Spider (1 suit)easy0.4359%0.32 / 0.49
FreeCelleasy0.5148%0.41 / 0.64
Klondikemedium0.6827%0.54 / 0.89
Baker's Dozenmedium0.7129%0.59 / 0.81
Klondike (draw 3)hard0.8310%0.85 / 0.90
Forty Thieveshard0.931%0.89 / 0.92
Spider (4 suit)hard0.970%0.96 / 0.96

Quick Usage ​

CLI ​

bash
# 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 --json

Rust ​

rust
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),
        _ => {}
    }
}

Dual-licensed under MIT or Apache-2.0.