FreeCell is a solitaire card game in which a deck of cards is randomly laid out onto a tableau of 8 columns that are then sorted into 4 foundation stacks via a series of constrained movements. In college, I used to mindlessly play this game all the time during lectures to stay awake. (Believe it or not, it made me a better student!) And while I proudly tracked my win rate, I didn't keep tabs on exactly which games I had played. After all, a deck of 52 cards had `52!`

possible starting tableaux, and I had no chance of playing them all.

Recently, I've started playing again, and I've wondered about the uniqueness and solvability of games. Even though each of the `52!`

tableaux is technically unique, some may be functionally identical to others due to the mechanics of the game. For example, two tableaux could have identical card layouts but with two of their columns swapped. From the player's perspective, this would make no difference to game play.

Thus, the number of unique starting tableaux is no longer very interesting. Instead, how many unique *games* exist? And how many of those are solvable?

## Solvability

Researching FreeCell's solvability required learning about the game's history. It was invented in the 1960s by 10-year-old Paul Allfile, who tweaked the rules to Baker's Game. Baker's Game is a solitaire card game with a frustrating solve rate. In a test of 10 million rounds of the game, only 74.3% of them could be won. Allfile's changes, however, greatly improved the game's solvability. It's estimated that 99.999% of all FreeCell games can be won.

Allfile later went on to implement the game on the PLATO computer system at the University of Illinois in the late 1970s, but the game wouldn't take off in popularity until Microsoft began including it in its Windows OS releases. The Windows 95 version of FreeCell came with 32,000 unique games that were numbered, allowing players to easily discuss solutions with each other. Of these 32k games, all but 1 are solvable. That's a 99.997% solve rate!

Later Windows releases would increase that number to 1,000,000 games, still numbered. Of these, only 8 are unsolvable – a 99.999% solve rate. Microsoft also included a couple of easter eggs (games numbered -1 and -2) that are unsolvable, but these are not included in my calculations.

And just because a game is solvable, that doesn't mean the solution is easy. Many have devoted years of their life to playing through all the FreeCell games and ranking their difficulty. Wow!

## Uniqueness

Microsoft ships with 1 million unique FreeCell games, but with `52!`

starting tableaux, more must be possible. That's 8.066 x 10^67 different starts!

As a side note, I didn't know that this number could be pronounced until recently! It turns out that a one followed by 66 zeroes is called an unvigintillion. It looks like this:

1000000000000000000000000000000000000000000000000000000000000000000

Or if that's too many zeroes next to each other, here it is again but with the commas:

1,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000

I have no idea how well that number shows up on mobile. Anyway, the point is that there are over 80 unvigintillion unique tableaux but not that many unique games.

So how can we reduce that number? Well, we know that when starting columns are swapped, they don't affect game play. Since the initial tableaux has 4 columns of 7 cards and 4 columns of 6 cards, we can divide the total number of tableaux by `2 x 4!`

. Now we're down to 1.68 unvigintillion games.

The game mechanics are also unaffected when the red suits are swapped or the black suits are swapped. So we can divide by 2 twice! That leaves us with 420 vigintillion (4.20 x 10^65) games.

I can't figure out how to further reduce this number, but Wikipedia assures me that there are only 1.75 x 10^64 unique games. Let me know if you can figure out how to get there.

Of these 1.75 x 10^64, I briefly wondered how many were solvable but realized that the question required more computational resources than I have available to calculate the answer myself. I'll just have to settle for the estimated 99.999% solve rate that Wikipedia claims.