TITLE: Probability of "clock patience" going out
QUESTION [5 upvotes]: 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!

REPLY [3 votes]: 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))