Little secrets · 04
A whole deck, inside one number.
You do not need to send someone 52 cards. Sometimes one number will do.
A deal number is a seed. Put it through the same number generator, start with the same ordered deck, and select cards in the same order: the whole layout returns.
Deal a number.
These are the first eight cards from our actual FreeCell engine, one for each column. Deal #1 starts with the familiar jack of diamonds, two of diamonds, nine of hearts.
A very small machine.
Our C core uses the documented 32-bit Microsoft CRT recurrence. The arithmetic wraps at 32 bits; the generator then takes 15 bits for each draw. This snippet comes from our implementation.
// Excerpt from our cores/freecell.c
random = random * 214013U + 2531011U;
int remaining = 52 - draw;
int selected = ((random >> 16) & 0x7fffU) % remaining;
int original_id = deck[selected];
int card = (original_id % 4) * 13 + original_id / 4;
int column = draw % 8;
After each selection, the last available card replaces the selected card in the working deck. Cards are dealt across the eight columns in turn. The starting deck order and this removal step matter just as much as the random-number formula.
Repeatable is something we can test.
The browser and the command-line player load the same WebAssembly module. Give both the same number and they produce the same arrangement. Our tests also check published deal fixtures. Comparing complete layouts against an original Windows executable is still a separate, unfinished check.
Source: our original-authored fc_new in cores/freecell.c. Background: Solitaire Laboratory's explanation of numbered deals. Reproducible fixtures support our implementation; they do not establish byte matching.