Experimental Analysis of
Canfield Solitaire

Jan Wolter
April 11, 2013

[General Introduction]

The Game

Canfield Solitaire is solitaire game dating back to the 1890's. It was supposedly played at Richard Canfield's casino in Saratoga Springs, with players "buying" a deck for $50 and being paid back $5 per card moved to the foundation, but whether this story is true, and whether the game involved was actually the game we now know as "Canfield" is uncertain. In any case, it is certainly appropriate to apply Monte Carlo methods to the analysis of a casino game.

Canfield is played with a single deck of cards and the goal is to move them all to the four foundation piles. A random card is dealt to one of the foundation piles at the beginning of the game, and all foundation piles must be built up from the rank of this base card, in suit, wrapping from king to ace if necessary. There are four tableau piles where you can build down in alternate colors. Initially one card is dealt to the tableau pile. Sequences of cards can be moved from one tableau pile to another. Thirteen cards are initially dealt to a reserve pile, all face down except the top card, which can be play to the tableau or the foundation. If any empty space opens up on the tableau, it is immediately filled with the top reserve pile. If the reserve pile is empty, then any card can be played in. Canfield has a stock that is dealt to the waste, three cards at a time, with unlimited redeals. The top card of the waste may be moved to a tableau pile or a foundation pile.

You can read the rules or play the game on politaire.com or many other places.

Canfield is well-known, but not as widely played as some other games these days. It is quite difficult to win. Some sites, like the Wikipedia, say that on the average it is only possible to remove five or six cards. I've seen credible claims from skilled players who say they win in the neighborhood of 35% of all games.

Solver

I programmed a depth-first-search solver for Canfield. It uses heuristics to decide which moves to try first. If it reaches a position from which no further moves are possible, it backtracks and tries another alternatives.

The program represented the stock and waste in a way that abstracted away all the repetitive dealing. This is similar to the way it is represented in Gallery Mode on Politaire.

I used a slightly more sophisticated heuristic function for this solver than I did for many others. It prioritizes moves so that the first moves in the following list were prefered over late ones:

Note that these heuristic functions help find solutions fast if there is a solution, but if there isn't a solution then all alternatives need to be explored before we can conclude that there isn't a solution, and it doesn't really matter what order we explore them in, so all of this computation to rate moves becomes useless. But it's profitable overall in Canfield because the percentage of winnable games is actually quite high.

It is not, at this point, a particularly terrific solver. Though for most games it will be able to report the the maximum possible number of cards that can be removed in a reasonable amount of time, in 1% to 2% of games it gets lost in combinatorial explosion and will runs until it exhausts the computer's memory and crashes. In my tests I terminated all such runs before they reached that point. Since the solver is substantially slower than the ones for Trigon or Captive Queens, I did many fewer runs than with those solvers.

Random Deals

I ran the solver on the first fifty-thousand Politaire games, seeds zero through 49999. It was able to win 35,606 games, about 71%. It failed to terminate on 664 games, so there is another 1.3% which might also be solvable, but probably aren't. An average of 39.9 cards were removed per game. If you could have played this well at Mr. Canfield's casino you would have won an average of $149 per hand, and would have been ejected rather quickly, I imagine.

The distribution of the number of cards moved to the foundation is shown in the chart below. Note that I include the one card dealt to the foundation in our count. I omitted the column for "52 cards" from the chart, because there were 35,606 of them so it was too much taller than the others.

Numbers of Removable Cards in 14,394 Random Unsolvable Canfield Games
In comparison to the graph for the Canfield variant called Storehouse, there are a lot of stillborn games, where no cards, or very few cards can be removed. This is because in Canfield we deal in chunks of three, so although there are 34 cards initially in the stock for both games, in Canfield only 12 are initially accessible.

This finding of a 71% solvability rate is not really inconsistent with the much lower win rates reported by players of the game. Even solvable Canfield games can be very hard to win. The system of dealing card three at a time from the stock to the waste means careful management of those cards is required. It is almost never completely safe to play a card from the waste, because its removal may leave cards that you need to get from the waste in the future inaccessible. To win a game sometimes requires leaving cards that could readily be played to the foundation on the waste for a long time. So the order in which you play cards from the waste can be a very touchy and unintuitive business requiring substantial advanced planning. And with twelve of the cards on the reserve dealt face down, that planning becomes virtually impossible.

Note that if we remove the three-at-time deal rule, and allow the player unlimited passes dealing one card at a time, the win rate goes up to something between 89% and 92% (based on the first 10,000 deals). But more signficantly, my solver was able to solve 69% of games without backtracking at all. This happened in only 1.2% of standard Canfield games.

I suspect that some of the lower estimates of success rates are based on games where you cannot undo moves, as would presumably be the case in a casino. People who win 35% are probably doing quite a lot of undoing.

Natural Shuffling of Gathered Cards

The next experiment run aimed at testing whether the game became significantly easier or harder when the cards were hand shuffled instead of being completely randomized by a computer. After the end of each hand, we pick up all the piles of cards on the table one at a time, flipping the face up cards face down, so their sequence is reversed. We then shuffle the deck with n riffle shuffles, cut it once, and deal out the next hand.

For each number of shuffles from one to ten, I ran ten thousand games in this manner.

Canfield Win Rate with n Shuffles of Cards Gathered from Previous Game
Red line is win rate with fully randomized deck

If you shuffle only once between games, then many more games are winnable. Two to four shuffles seem to make the game a bit harder.

On the whole, Canfield seems less effected by a poorly shuffled deck than some of the other games I have studied. This makes sense. Given that we are allowed infinite passes through the stock, it probably doesn't matter much what order those cards are in. Though it is nice if whole sequences of same suit cards are all in the stock, without too many key cards being stuck in the reserve. The tableau starts with only one card in each pile, so we don't have to worry about digging cards out from under each other as in Trigon. It is nice if some cards that can be built on top of each other are initially dealt there, but that isn't generally critical. The order of the 13 cards in the reserve matters more, they are probably generally easier to get off if lower ranked cards are on the top and higher ranks are below. So, overall, it's not terribly surprising if complete randomization isn't very necessary in Canfield.

But there's another reason why the difference might be dampened for Canfield. There are a lot of Canfield games where only a few cards can be removed to the foundation. Sometimes no moves can be made at all. In such a case, very little sorting happens before we pick up and shuffle again, so effectively more shuffling happens compared to the amount of sorting.

I don't think this experiment predicts the real experiences of a player very well though, because real players don't win 71% of games, so don't fully sort deck nearly as often. They probably pile up a few cards on the tableau and so generate at least as much reverse ordering, with alternating suits, as forward ordering.

Natural Shuffling of Ordered Decks

To see the impact of sortedness on Canfield more clearly, I ran some tests starting with a fully ordered (or reversed) deck before each hand and shuffling that n times before cutting the deck and dealing it. Here are my results from that test, running ten thousand iterations of each value of n from one to ten.

Canfield Win Rate with n Shuffles of a Ordered/Reversed Deck
Red line is win rate with fully randomized deck

At first, this look a lot like the Trigon graph, but there's an important different, With Trigon it was residual reverse sorting that made the game harder, while residual forward sorting made it easier. With Canfield it's the other way around.

I think it has to do with the long reserve stack. Clearing this tends to be the focus of Canfield games. Dealing the reserve from a ordered deck puts it in reverse order, with cards tending to be on top of their predecessors. This makes it somewhat harder to get them off.

The forward ordering I tested here is not the same as the reversed ordering that a player generates when he builds cards on the tableau, because that has alternating suits. Still, it's possible that these losing games might help a player who doesn't shuffle well build up some residual reverse order that might help him win a game, which then orders the deck, making things harder again.