Canfield Solitaire

April 11, 2013

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.

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:

- Moves to the foundation of cards from the tableau or of one of the last two cards in the waste, if they don't get the foundation pile more than two cards ahead of either opposite colored foundation pile. (These are safe moves to which no alternatives need be considered.)
- moves from the tableau that empty a tableau pile.
- building tableau piles or foundation piles toward either the top reserve card (if it is not the only reserve card) or the bottom card of a tableau pile. If multiple such moves are possible, we prefer building on the tableau or foundation pile that has a shorter distance to go before it can accept the goal card.
- Moves to the foundation of cards which are deeper in the waste, that still don't get the foundation pile more than two cards ahead of either opposite colored foundation pile.
- Moves to the foundation of cards that do get the foundation pile more than two cards ahead of either opposite colored foundation pile.
- Moves from tableau to tableau that don't empty a space, but do uncover a card that could immediately be moved to the foundation. (No other tableau to tableau moves are ever done.)
- Moves from waste to tableau of cards that don't build toward the top reserve card or the base card of any tableau pile.

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.

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.

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.

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

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.

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.