QQuickLab
← All articles

· QuickLab

How we promise “every deal is solvable”: card game solvers and difficulty

Random shuffles include unwinnable deals. How Lantern Cells and Pinegold use a solver to pick deals, measure difficulty and order 120 levels.

Shuffle 52 cards and some deals simply cannot be won. Players cannot tell bad luck from bad play, which feels unfair. So every deal in Lantern Cells and Pinegold was solved by a program before release.

1. States and best-first search

The solver treats each board as a state and explores moves as graph edges. In Lantern Cells the score counts cards not yet home, out-of-order spots in columns, cards buried on top of the next card needed, and occupied cells; lower is closer to done, and the lowest is expanded first. Visited states are hashed; in FreeCell, columns are sorted first so equivalent boards are not searched twice.

2. Safe moves happen automatically

A card can go home safely when both opposite-color suits are one rank below it. The game’s auto-collect uses the same rule, so stored solutions replay exactly in the real rules.

3. A Klondike solver that sees every card

To guarantee a deal is winnable, it is enough for a solver that knows the face-down cards to win it. Whether a human finds that path is checked separately through play. Stock draws are grouped into a single move (“draw N times, then play this card”), which keeps the search small and handles Draw 1 and Draw 3 exactly.

4. Measuring difficulty

GameMeasureMeaning
Lantern CellsMinimum free cellsFewest cells needed to solve; fewer means more slack.
Lantern CellsSearch nodesStates explored; more means a narrower path.
PinegoldMinimum stock passesFewest recycles of the stock needed.
BothParMoves in a short solution; the three-star target.

These combine into a score so difficulty never drops within a pack and pack averages keep rising. Pinegold’s Draw 3 deals fill the last two packs; Lantern Cells’ last pack has only three cells.

5. Tests keep the promise

Tests replay all 120 stored solutions under the real rules, check the difficulty order, and confirm 30 consecutive Daily Deals are solvable. The Daily Deal is shuffled from the date and reshuffled if the hint solver cannot finish in time.

The solver does not guarantee the shortest solution and has a node cap, so measured difficulty can differ from how a deal feels. We keep adjusting the order from real play.

Related articles

Seven habits that win more Klondike solitaire games

Dig the tallest hidden column first, empty a column only when a King is ready, and scan the board before you draw. Klondike tips from building Pinegold.

Read →

Stuck at FreeCell? Five habits that save your free cells

FreeCell is a game of planning, not luck. The supermove formula, why an empty column beats free cells, and the order of play we learned while building Lantern Cells.

Read →

Seven rules we set while building apps for two-year-olds: Dodam Play and Color Wiggle

Ads, sound, praise, failure and parent locks: the principles behind our upcoming toddler learning app and kids coloring app.

Read →

Amortizing vs equal principal vs interest-only: the interest gap on a 100,000 loan

Same loan, same 4.5% rate, same 30 years, yet total interest ranges from about 67,700 to 135,000 depending on how you repay. How each method works and how to choose.

Read →

What we learned building 42 web tools that run entirely in your browser

Removing modulo bias from random numbers, a metronome that never drifts, line diffs with LCS and Markdown that scripts cannot sneak into: the small techniques behind QuickLab’s free tools.

Read →

The arithmetic is right—so why is the puzzle wrong? A Math Lattice guide

Worked examples for crossing equations, practical solving tips, and ways to play with children and older adults—without overstating school or brain-health benefits.

Read →

Stuck on a line puzzle? Leave a route for the other colors

Practical Lumen Lanes tips for tight passages and connection order, ways to play with family, and what brain-health research does—and does not—tell us.

Read →

Studying English words with Word Sprout: a tour of every feature, with screenshots

From snapping a school word list to flash cards, multiple choice, matching pairs, spelling, dictation, tests and an exam date. A screen-by-screen look at Word Sprout’s learning features and why each one is there.

Read →

Making mobile puzzle games in Unity, with no scenes or prefabs

How we build Pour Parade, Math Lattice and Munchling Meadow in Unity: how we pick an engine, a project built entirely in code, tests that run without Unity, and where AdMob and Hindi text tripped us up.

Read →

Turning Blender into a game-art script with Python

How Word Sprout’s flower pots, mascot, 113 flower cards and 3D garden are made with Blender Python scripts: building characters from basic shapes, Freestyle outlines, and exporting meshes for Unity.

Read →

Stuck on a color sort puzzle? Start by saving the empty bottle

Why pour-and-sort puzzles suddenly jam up in later levels, and how to get through them with fewer moves, using Pour Parade as the example.

Read →

We put four games on Google Play

The four games MandooHai Studio has released on Google Play so far, and a few things we try to stick to when making them.

Read →

A week before the word test, 15 minutes a day is enough

Instead of cramming the night before, spend 15 minutes a day for a week. A day-by-day plan for a child’s English word test.

Read →

Spaced repetition and the Leitner box: for kids who forget yesterday’s words

Why words your child knew last night are gone by morning, and how to try the Leitner system, five boxes that decide when to review, at home.

Read →