# Probability of “clock patience” going out

Here is a question I've often wondered about, but have never figured out a satisfactory answer for. Here are the rules for the solitaire game "clock patience." Deal out 12 piles of 4 cards each with an extra 4 card draw pile. (From a standard 52 card deck.) Turn over the first card in the draw pile, and place it under the pile corresponding to that card's number 1-12 interpreted as Ace through Queen. Whenever you get a king you place that on the side and draw another card from the pile. The game goes out if you turn over every card in the 12 piles, and the game ends if you get four kings before this happens. My question is what is the probability that this game goes out?

One thought I had is that the answer could be one in thirteen, the chances that the last card of a 52 card sequence is a king. Although this seems plausible, I doubt it's correct, mainly because I've played the game probably dozens of times since I was a kid, and have never gone out!

Any light that people could shed on this problem would be appreciated!

-
I think you forgot to describe one step in the game (or I didn't understand your description): when do you get to turn over cards that are not in the extra draw pile? – Raskolnikov Feb 2 '11 at 17:30
Oh well, never mind. – Raskolnikov Feb 2 '11 at 17:32
@Raskolnikov: Thanks for the link. – Grumpy Parsnip Feb 2 '11 at 18:25
If you've never won, you're one unlucky chap! But never mind, you know what the say, unlucky at cards ... :-) – Derek Jennings Feb 2 '11 at 18:45

Here's an explanation of why it's 1/13.

We are essentially dealing out a randomly ordered deck into piles of a kind of four, and we require that the pile of kings be the last pile completed. And so the probability of winning is 1/13.

Maybe this is more convincing. Imagine playing the game backwards with the deck facing you so that you can see the cards. Remove the top card, a seven, say, the next card facing you is a two, say, so you place the seven in the pile at the two o'clock position, the next card facing you is a five, so you place the two at the five o'clock position. You now take the five from the deck and see a king beneath it, so you place the five in the king pile, and so on.

You continue until you've placed out all the cards and, if you are going to win this game (when it's played in the correct direction), the last card must be placed in the king pile because that's where you take your first card from when you run the game in the right direction. Now the only way that can happen is if you placed a king down as your first card. And that's a 1/13 chance with a random ordered deck.

-
I'm not completely convinced by this argument, which is essentially the one I'd already thought of. The potential problem that I see with it is that we are assuming the distribution of card orders coming from applying the clock patience rules is homogeneous with respect to random initial shuffles. – Grumpy Parsnip Feb 2 '11 at 19:23
So the transformation to the "Score Four" game doesn't preserve probabilities. – Grumpy Parsnip Feb 2 '11 at 19:26
@Jim: Please see my additional explanation in my edit. Regards. – Derek Jennings Feb 2 '11 at 20:24
Okay, I'm convinced. I'm a victim of my own bad luck in cards. :) – Grumpy Parsnip Feb 2 '11 at 20:59

The name clock patience (solitaire in the US) is appropriate, not just because of the shape of the layout but because it is about cycles in the permutation. As you start with the King pile, a cycle ends when you find a King. If four cycles (one for each King) include all 52 cards, you win. You lose if the bottom card on any non-King pile matches its position, as that would be a one-card cycle in the permutation. You also lose if the bottom card in the Ace pile is a Two and the bottom card in the Two pile is an Ace. I'm trying to figure out the impact of the fact that suits are ignored. Maybe you can give each card its particular destination (always put the spade ace on top, for example) and ask for a single cycle of the 52 cards. In that case, it would be 1/52. To make a single cycle, the first card cannot go to itself (51/52). The card the first card goes to cannot go to the first (50/51). Then the next card in the chain cannot go to the first (49/50) and so on.

-
I wonder if one could rephrase my question to ask what the probability is that a random permutation of 1...52 has exactly 4 cycles with 1,2,3,4 belonging to distinct cycles. – Grumpy Parsnip Feb 2 '11 at 19:34
1/52 seems very plausible, as it does feel like you are counting how to make a single cycle out of all 52 cards. – Grumpy Parsnip Feb 2 '11 at 19:39

I'd always thought the answer was one in thirteen on the basis that you win if the last card turned up is a king. But then one day while playing clock patience I started thinking along the lines of Ross and Eric - how can you end up with 1/13 when you have to worry about whether a bottom card matches its position? So I wrote a python program to shuffle a pack randomly a million times and play the game. The python program (very inefficient but seems to be effective) produces results similar to these every time it's run:

Won 76921 out of 999700 plays = 0.076944% win rate ~= 1/13 = 0.076923%
Won 76928 out of 999800 plays = 0.076943% win rate ~= 1/13 = 0.076923%
Won 76937 out of 999900 plays = 0.076945% win rate ~= 1/13 = 0.076923%
Won 76939 out of 1000000 plays = 0.076939% win rate ~= 1/13 = 0.076923%


which suggests that the answer 1/13 is correct. Here's my program:

from random import randint
from random import seed

def createpack():
"Creates a pack of cards - four lots of 1-13"
# N.B. there's an extra one named pack[0] which is ignored
pack = range(0,53)
for i in range(1,53):
pack[i] = (pack[i]-1) % 13 + 1
return pack

def shuffle(pack):
"Shuffles the pack of cards"
for i in range(1,53):
j = randint(1,52)
k = pack[j]
pack[j] = pack[i]
pack[i] = k
return pack

def dodeal(pack):
"Deals the pack of cards randomly into 13 sets of 4"
deal = [[0]*4 for i in range(1,14)]
pack = shuffle(pack)
k = 0
for i in range(0,13):
for j in range(0,4):
k += 1
deal[i][j] = pack[k]
return deal

def play(deal):
"Plays out the clock patience game, returning 1 for a win, 0 otherwise"
i = deal[0][0] - 1
deal[0][0] = 0
nc = 0
winning = 1
while (nc < 52) and winning:
nc += 1
j = 0
while (j < 4) and (deal[i][j] == 0) and winning:
j += 1
if (i==0) and (j==4):
if (nc < 52):
winning = 0
else:
k = deal[i][j] - 1
deal[i][j] = 0
i = k
return winning

pack = createpack()
nwon = 0
for nplayed in range(1,1000001):
deal = dodeal(pack)
won = play(deal)
if (won):
nwon += 1
if nplayed % 100 == 0:
print("Won %d out of %d plays = %8.6f%% win rate ~= 1/13 = %8.6f%%" %
(nwon, nplayed, float(nwon) / nplayed, 1.0/13.0))

-
Thanks for that. I finally convinced myself that 1/13 was correct by working out what happens for smaller packs. For example, looking at what happens when you only have 2 or 3 piles rather than 12. – Grumpy Parsnip Aug 15 at 15:52

If I understand you correctly, then the game is won if the $48$ cards on the regular piles contain fewer than $4$ kings. Let's try to calculate the probability that the game is lost instead. It is exactly $$\frac{\binom{48}{44}}{\binom{52}{48}} = \frac{38916}{54145} \approx 72\%.$$ There are $\binom{52}{48}$ possible choices of the regular piles, and out of these $\binom{48}{44}$ contain all four kings.

-
Yuval, the statement "then the game is won if the 48 cards on the regular piles contain fewer than 4 kings" is not true. Perhaps I didn't describe the rules well enough. Raskolnikov's link has another exposition. – Grumpy Parsnip Feb 2 '11 at 18:24

As Ross said, you cannot get out if the bottom card matches it position, because there is no way to access it. At best, the probability of each bottom card being different from its position is 12/13. So the chance of all 12 being different (assuming independence which is approximately true) is 12/13 to the power 12, which is 0.38. So the chance of success is at best 1/13 times 0.38 which is about 1 in 34. However, it will be slightly less than this, as Ross highlights other problems (such as an 4 being at the bottom of 2 o'clock and 2 being at the bottom of 4 o'clock). You could go on with circular combinations involving more than 2 that means that certain cards can never be reached.

-