Experimental Analysis of
Indefatigable Solitaire and
Royal Family Solitaire

Jan Wolter
January 12, 2014

[General Introduction]

The Game

Indefatigable Solitaire is played with a single deck of cards. The goal is to move the them all to the four foundation piles, where we build upward from ace to king, in suit. The four aces start on the foundation, and the other 48 cards start face up on the tableau, in 12 piles of 4 cards each. Only single cards can be moved, but on the tableau you can build up or down in suit. Empty tableau spaces may be filed with any card. If you get stuck, you may twice redeal the tableau, picking the cards up column by column, and then dealing them out, without shuffling, row by row, until you run out of cards.

Royal Family Solitaire is the identical game, except we build downward on the foundation, starting from the four kings initially dealt there, and we only have one redeal instead of two. The fact that we build down instead of up on the foundation obviously makes no difference to the likelihood of winning. From an analytical point of view, Royal Family is just Indefatigable with one redeal instead of two.

You can read the rules for Indefatigable or Royal Family, or play Indefatigable or Royal Family on politaire.com.

These are both quite easy games. I have played hundreds of randomly generated games of Indefatigable without having found a single one that I couldn't win. It nearly always seems to be possible to win, although it typically does need some thought and planning to solve any particular game. Many games can be won without a redeal.

But it is obviously possible for an unwinnable deal to occur. It is easy to construct such a game. For example, consider the game of Indefatigable below (here the cards at the bottoms of the columns are the playable cards on the tops of the stacks):

2♥2♠2♦2♣4♠4♥4♣4♦5♣9♥9♠7♥
6♥6♦10♥6♠6♣10♦7♣5♥8♣9♦7♠J♠
Q♥Q♣8♥Q♦Q♠8♦10♣10♠8♠9♣7♦J♣
3♥
 
3♠
 
K♦
 
3♦
 
3♣
 
K♣
 
5♠
 
5♦
 
K♠
 
J♦
 
J♥
 
K♥
 

As you can see, no moves can be played here, because none of the "top" cards (which are on the bottoms of the columns) can be played on any other, and no twos are available, so nothing can be moved to the foundation. So the only option is to redeal, which gets us this:

2♥6♥Q♥3♥2♠6♦Q♣3♠2♦10♥8♥K♦
2♣6♠Q♦3♦4♠6♣Q♠3♣4♥10♦8♦K♣
4♣7♣10♣5♠4♦5♥10♠5♦5♣8♣8♠K♠
9♥
 
9♦
 
9♣
 
J♦
 
9♠
 
7♠
 
7♦
 
J♥
 
7♥
 
J♠
 
J♣
 
K♥
 

There are again no moves, so we need to redeal again:

2♥2♣4♣9♥6♥6♠7♣9♦Q♥Q♦10♣9♣
3♥3♦5♠J♦2♠4♠4♦9♠6♦6♣5♥7♠
Q♣Q♠10♠7♦3♠3♣5♦J♥2♦4♥5♣7♥
10♥
 
10♦
 
8♣
 
J♠
 
8♥
 
8♦
 
8♠
 
J♣
 
K♦
 
K♣
 
K♠
 
K♥
 

And there are no moves here either so the deal is thoroughly unsolvable.

Solver

I programmed a depth-first-search solver for Indefatigable. The key to making this fast was rig things so that we never break up stacks. Once a group of two or more cards are in sequence on the tableau, we never break them up. We may move the stack to a new location, one by one, reversing the sequence of the stack, but we always keep them together once they are together. I'm convinced that any winnable Indefatigable game is winnable without breaking sequences. I also allowed non-reversing stack moves if there was an empty stack as a sort of a supermove. These modifications greatly reduce the number of choice points in the search tree, and it becomes easy to solve most games quickly.

The initial version of the solver did not do redeals. The second version did limited redeals, allowing a redeal only after the best solution to the previous tableau had been found. The third version allowed redeals at any time.

Without Redeals

I ran the no-redeals solver on the first hundred-thousand Politaire games, seeds zero through 99999. It was able to win 87,779 games, about 88%. An average of 46.3 cards were removed per game.

The distribution of the number of cards moved to the foundation is shown in the tablea below:

Maximum
Cards
Removable
Percentage
of
Games
03.260%
13.526%
22.428%
31.542%
40.778%
50.383%
60.174%
70.079%
80.031%
90.012%
100.003%
110.002%
120.002%
140.001%
4887.779%

Note that I do not include the four aces dealt to the foundation in the counts of removable cards. So it appears that when the game is unsolvable, it is almost always because few or no cards can be removed. In my experience, you can nearly always win any game where a column can be emptied. Game 68696, however, seems to be a counter example to this. Though a column can be opened, my solver could remove no more than 14 cards (not counting the aces) without a redeal, and I could do no better.

With Redeals

If 88% of games can be won without a redeal, a naive estimate of the number of games solvable with a one or two redeals would be in the neighborhood of 98.5% and 99.8% respectively - just the chances of losing two or three consecutive random games. But, of course, the redeals are not independent. First, the redealt tableau tends to have slightly fewer cards than the original (though, as we can see from the table above, rarely many fewer). Second, since there is no shuffle before the redeals, some of the ordering established in the previous round will carry over to the next. Because of the deal order, mostly this means that sorted columns now become sorted rows, which isn't very helpful if it is a deeply buried row, but can be very helpful if it is one of the top rows. So, on the whole, we have cause to suspect that the win rate is actually higher than 98.5% for Royal Family or 99.8% for Indefatigable.

In my next test I modified the solver to be able to do redeals in a limited way. It would find the maximum number of cards it could remove from the initial tableau, then it would pick randomly one of the "dead end" states where that number of cards had been removed, and redeal from that state. It would then start anew solving the redealt tableau. It would never backtrack to undo the redeal, and try redealing from a different end state.

Running this on the first 100,000 Politaire seeds, this solver was able to win 99250 Royal Family games, and 99,957 Indefatigable games. That is to say that it won all but 750 Royal Family games and all but 43 Indefatigable games, for win rates of 99.25% and 99.96% respectively.

This does not mean that those 43 Indefatigable games are actually insolvable however. The best time to redeal is not necessarily when the most cards are off. So the actual percentages of winnable games are presumably higher still.

So I wrote a third version of the solver, which allows redeals to be performed at any time, even when there are legal moves that can still be made. This adds some complexity to the solver, because not only does it have to be able to do and undo redeals in the course of its search, but it loses the advantage of "safe moves". Normally some moves, like moves of cards to the foundation, are safe moves. You can just perform them without considering alternatives. But if we are allowing redeals at any point in the game, then redealing is always an alternative, and no move is completely safe. Also, because this is a depth-first solver, it tends to find "deep" solutions, not the shortest solution, so it tends to use all available redeals in every game it plays, whether they are needed or not.

I ran the full solver on the first million Politaire seeds. For the Royal Family game, it was able to win 998,011 games out of a million, failing on 1,989 games, a 99.8% win rate.

For Indefatigable, it was able to win 999,977 games out of the first million, failing on only 23 games, for a 99.998% win rate. The complete list of unsolvable seeds is below:

SeedRemovable
Cards
#2913220
#602357
#723468
#767822
#913010
#203421
#166845
#643855
#941162
#941723
#294042
#407981
#694854
#789086
#835789
#914573
#401963
#53972
#631796
#757070
#780153
#3516844
#7113699

As usual, the unsolvable games turn out to be ones where very few, if any, cards can be removed. One of them, game #602357, is similar to the hand-constructed example at the begining of this report - not only can no cards be removed, but none can even be moved.