How deals are shuffled and certified winnable
By Spider Solitaire Online Editorial Team · Published
Each deal is a seeded shuffle, so the same deal code always gives the same cards. A deal is certified winnable only after a solver finds a full winning line and the game engine replays every move to a win.
Every game on this site starts from a shuffle, and some shuffles are labelled "certified winnable". This page explains both: how a deal is generated from a number, what the number does and does not guarantee, and what we mean when we say a deal has been certified. Where the page gives figures, they come from our own files and scripts and are stated with their limits.
Deals come from seeds
A computer cannot shuffle cards in the physical sense. It produces a list of numbers that look random and uses them to rearrange a deck. We make that list with a small, well-known generator called mulberry32. You give it a starting number, the seed, and it produces the same sequence of numbers every time, on every device, because it uses only 32-bit integer arithmetic that every browser computes identically.
To build a deal, the game creates the unshuffled deck for the mode (104 cards for the standard game: the right number of copies of each suit and rank), then reorders it with the Fisher–Yates method, which walks down the deck and swaps each card with a randomly chosen card among those not yet fixed in place. Fisher–Yates is the standard way to shuffle without bias, provided the numbers behind it are fair. The first 54 shuffled cards go to the ten columns, with the last card in each column face up, and the remaining 50 become the stock.
Because the process is fully deterministic, the seed alone identifies a deal. That is the reason for the deal code you see on screen, such as SS-2-481516. The letters say it is a standard Spider deal, the middle number is the suit count, and the last number is the seed. Enter the same code later, or on a different device, and you get identical cards in identical positions.
What a seed does not give you
A seed is a 32-bit number, so there are at most about 4.3 billion different seeds for any suit count. That sounds large, but the number of possible arrangements of two decks is vastly greater. So the game reaches only a tiny fraction of all possible deals. For play that makes no practical difference, since nobody will exhaust 4.3 billion games, but it is why we describe the shuffle as seeded and repeatable, not as covering every conceivable deal.
When you start a random game, the seed itself is chosen using your browser's cryptographic random number source, not mulberry32. The deterministic generator is only used to expand the seed into a deck. The choice of seed is therefore not predictable from earlier games.
Not every deal can be won
Spider Solitaire is a game of hidden information, and some shuffles leave no sequence of legal moves that clears the table, even for a player who knew every card. In a one-suit game most deals can be won with good play; in a four-suit game a large share cannot. We do not publish a figure for the share of winnable deals, because we have not measured it: proving that a deal is unwinnable is far harder than finding a win for a winnable one.
That is the reason the site offers certified deals. They let you play a game that is known to be possible.
How a seed-table deal is certified
For one and two suits we certify deals by searching. The steps are:
- Take the next seed in order, starting at 1, and build its deal exactly as the game would.
- Run the solver. The solver is a program that sees every card, face up or face down, and searches for a complete winning sequence. It uses depth-first search with a transposition table, meaning it remembers positions it has seen so as not to repeat them, and it restarts several times with slightly different move orderings to escape bad branches. Each attempt has a fixed budget of positions to explore.
- Replay the answer. If the solver reports a win, the winning moves are applied one at a time to a fresh copy of the deal using the same game engine you play on. Only if every move is legal and the eighth run is removed does the deal go into the table, together with its move list.
The third step is the important one. The solver is complicated and could in principle contain mistakes, but a mistake cannot produce a false certificate, because the engine checks the result independently. A flaw in the solver can only cause it to miss solutions that exist.
What the numbers are
| Suits | Method | Seeds tried | Certified | Share found within budget |
|---|---|---|---|---|
| 1 | Seed search, 30 restarts of 30,000 positions | 1,295 | 1,190 | 91.9% |
| 2 | Seed search, 60 restarts of 40,000 positions | 933 | 690 | 74.0% |
| 4 | Constructed (below) | 1,258 attempts | 400 | 31.8% |
Read these carefully. "Found within budget" does not mean the rest are unwinnable. For one suit, 105 of the 1,295 seeds had no solution found in the time we allowed. They may be winnable, difficult, or impossible; we do not know. The consequence is that the certified set is not a random sample of all deals. It is biased towards deals that our solver finds easy to crack, which in practice tends to mean deals with more room to manoeuvre.
Why four suits are different
We ran the same search on four-suit deals and found no solutions. In a benchmark the solver solved none of the first six four-suit deals it was given, and a later run of about twenty-five minutes at a larger budget also found none. That is a limit of our solver, not proof that four-suit deals are unwinnable, since skilled people do win them. But it means that for four suits we could not certify ordinary random shuffles at all.
Constructed deals
For four suits, we turned the problem around. Instead of shuffling and then searching for a win, we generate a deal by playing a game forwards and choosing the hidden cards as they are revealed. Imagine a dealer who looks at the table and decides, each time a face-down card is about to turn over, what it will be. The dealer is only partly cooperative: with probability 0.3 the card is chosen to be useful, and otherwise it is chosen from the remaining cards at random. We tested cooperation levels and found 0.3 produced the most successful results. A fully helpful dealer actually does worse, because it builds traps.
If the game played this way ends in a win, then the order in which cards were chosen is a deck order, and the moves played are a winning line. We record the deck order and the moves.
As with seed deals, nothing is trusted until it is checked. The recorded order is loaded into the real engine as a fresh deal and the moves are replayed. Only a deal whose replay clears all eight runs is kept. Of 1,258 attempts, 400 passed.
These deals are winnable by construction, but they are not uniformly random shuffles. They lean towards being cooperative, to the degree set by the 0.3 parameter. We label them as constructed wherever they appear, and their codes start SC- instead of SS-.
How you see the result
On the winnable deals page you choose a suit count and the game draws a certified deal. When you win, a button lets you watch the stored solution being played back on the same deal. The daily deal on the daily page is picked from the same tables by the server, using a secret value so that future dailies cannot be read from the site's files.
Each table is stamped with the version of the game engine it was made with. If the engine ever changes in a way that alters how a deal is laid out or how moves work, old tables would no longer be valid, and our certification script refuses to extend a table made under a different version. An automated test also replays every stored one-suit and two-suit solution against the current engine, so a change that broke a certificate would be caught before release.
Check one yourself
You do not have to take our word for any of this. Start a game on the winnable deals page, note the deal code, and win it. The win screen offers the stored solution. Watch it play out: each move is a legal move on the cards in front of you, made by the same engine as your own, and the last move removes the eighth run. For seed-table deals you can also type the code into the standard game and play the identical cards yourself, with no certificate involved.
The same applies to any deal code from the random game. Enter SS-1-7 and you will find the layout used in the first-game guide: the same ten tops, every time.
What certified does not promise
- It does not promise that the deal is easy, or that you will find the solution.
- It does not promise the solution is short or elegant. It is whatever the solver found first.
- It does not promise the deal is typical. See the bias noted above.
- It does not cover Spiderette, which has no certified tables.
Questions about deals
Is a deal code private?
No, and it is not meant to be. It only identifies a shuffle, and sharing it lets someone else play the same cards. It contains nothing about you.
Why do constructed codes start with SC?
Because they cannot be rebuilt from a seed. A constructed deal is stored as an explicit card order, and the code gives its number in our table, so the game can find that order again. This is also why we say plainly that those deals come from a different source than random shuffles.
Could the same random deal appear twice?
Yes, in principle, if the same seed were chosen again. With 4.3 billion seeds for each suit count it is very unlikely in ordinary play, and if it happens you can recognise it from the deal code.
Related reading
To understand the odds without certified deals, see the win rates by suit count page. For how the in-game hint differs from the solver, see how the hint works. For the rules the engine enforces, see the rules.