Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Consider the situation from this video. Cards from a normal playing deck are dealt out one at a time while the player guesses what the number of the card is not (suit is ignored). To be clear, the player wants to go through the entire deck, never having their guess match the card. What are the odds that the player will achieve this, assuming they possess a perfect memory and use a perfect strategy? There is some discussion on the show's forums.

share|improve this question
2  
You should add the fact that the goal is to never guess correctly. This is not clear. –  Aaron Jun 6 '11 at 10:57
    
Is the player home free once four cards having the same face value have already appeared (because that value can safely be "guessed" for the remainder of the game)? –  hardmath Jun 6 '11 at 14:25
add comment

3 Answers

up vote 9 down vote accepted

The probability is $$\frac{47058584898515020667750825872}{174165229296062536531664039375} \approx 27.0195\%$$ which matches the several simulations in your linked forum posts and in Paxinum's answer here.

First, I'll sketch a proof that the optimal strategy is to each time guess any rank (1 to 13) that has been seen the most number of times so far. If this is obvious to you, you can skip to the next section.

Optimal strategy

Let's call each guess you have to make a "round". So the game has at most 52 rounds.

Claim 1. The optimal strategy is to guess, in each round, a rank which maximises the probability of winning that round.

Proof. Essentially, a guess in any round does not constrain future guesses. Whatever you guess, it determines only whether the game ends immediately, and not the future state which is determined by what cards are in the deck and not by what you guess. Formally, suppose you have any strategy $S$ which in some round guesses a rank that is not optimal for that round. Then you can replace it with a strategy that in that round guesses the best rank, and in future rounds does exactly the same as $S$. (For this proof to work, we can modify the game so that we continue to make guesses for all 52 rounds, and only at the end decide that we have lost the game if we ever guessed a card correctly. This obviously doesn't affect the game.) This strategy has a strictly higher probability of winning than $S$; thus $S$ is not optimal.

Claim 2. In each round, the best guess is a rank which has been seen the most number of times.

Proof. Suppose rank $r$ has been seen $s_r$ times so far, and that there are still $D$ cards in the deck. So there are $(4-s_r)$ cards of rank $r$ still in the deck. If you guess $r$, the probability of losing that round, i.e., the probability that the next card that turns up has rank $r$, is $\frac{4-s_r}{D}$, which is minimised when $4-s_r$ is minimum, i.e., $s_r$ is maximum.

Putting them together,

Corollary. The optimal strategy is to guess, in each round, a rank which has been seen the most number of times.

Note that if you have seen multiple ranks the same number of times ($s_{r_1} = s_{r_2}$), it doesn't matter which one you guess. So let's assume wlog that you guess (say) the smallest such rank.

Computation

Now that we have fixed the strategy, how do we calculate the probability that it wins the game? In principle, we could try all permutations of the deck and see for how many it works. In practice, that leaves us with $52! > 10^{67}$ permutations, out of which you can at most sample a few and check (as the other answer and simulations have done), but you cannot possibly enumerate them all. Even if you notice that you don't care about the suit, you still have $52!/4!^{13} > 10^{49}$ orderings, and even if you observe that the ranks are symmetric you still have $52!/(4!^{13} \times 13!) > 10^{40}$ orderings to check.

For something better, notice that the state of the game at any point is captured by the number of times you have seen each rank so far (the $s_r$s above); the order in which they originally appeared is irrelevant now and in the future. Thus we can describe the state of the game by specifying $s_r$ for each $1 \le r \le 13$, and as $0 \le s_r \le 4$, this gives $5^{13} = 1220703125$, much more manageable. For something even better, note that as you don't care about the actual ranks but only their number, you can simply keep how many of the cards have been seen 0 times, how many have been seen 1 time, etc. That is, let $n_k$ denote the number of $r$ for which $s_r = k$. Then the state is $(n_0, n_1, n_2, n_3, n_4)$, and $\sum_{k=0}^{4} n_k = 13$. In fact, for any state in which $n_4 > 0$ you can determine the probability of winning from that state immediately (it is $1$, as you will keep guessing any $r$ for which $s_r = 4$, and never be wrong), so you only need to care about states in which $n_4 = 0$. The number of such states is the number of nonnegative integer solutions to $n_0 + n_1 + n_2 + n_3 = 13$ which is $\binom{16}{3} = 560$, a number small enough that with enough patience one could even handle it by hand.

Let $p_n$ be the probability of winning from state $n$, where the tuple $n = (n_0, n_1, n_2, n_3, n_4)$ is as above. The number of cards seen so far is $\sum_{k=0}^4 {kn_k}$. The number of cards still in the deck, $D$, is 52 minus this number. If $n_4 > 0$, then $p_n = 1$. Else, let $g$ be the largest $k$ for which $n_k > 0$. You will guess a rank counted in $n_g$. The number of ranks with each count, other than the one you guess, is $$n'_k = \begin{cases}n_k & \text{if $k\neq g$,} \cr n_k - 1 & \text{if $k=g$.}\end{cases}$$ For a particular $k$, for each rank counted in $n_k$, the probability that the next card that turns up is of that rank is $\frac{4-k}{D}$, so the probability that some card of any such rank (other than the one we guess) turns up is $\frac{n'_k(4-k)}{D}$. Once such a card turns up, the next state has one less rank in $n_k$ and one more in $n_{k+1}$. That is, calling the new state $m = m(k)$, $$m_j = \begin{cases}n_j - 1 & \text{if $j = k$,} \cr n_j + 1 & \text{if $j=k+1$} \cr n_j &\text{otherwise.} \end{cases}$$

So the probability of winning from state $n$ (if $n_4 = 0$) is $$p_n = \sum_{k=0}^{3} \frac{n'_k(4-k)}{D}p_{m(k)}.$$

(The code, if anyone's interested, is at the end of the second revision of this answer).)


Edit: By Googling for the answer obtained above, I found this paper:

  • Kevin Liwack, Oleg Pikhurko, Suporn Pongnumkul (2008), How to Play Dundee. arXiv 0803.0156

They consider this problem and obtain exactly the same answer. They too say "it seems that there is no general closed formula" and find the answer by computer; they seem to be using the algorithm I mentioned in passing above, which for this standard deck considers $5^{13}$ states. They also study the variant where the player has to specify all the sequence of guesses in advance. For some reason they have a relatively long proof that the greedy strategy above is optimal, but I can't find any bug in my proof above.

share|improve this answer
add comment

Ok, second attempt:

It is clear, that as soon as we've seen 4 of the same value, we are safe. Also, if the first card is, for example, 1, then the probability that the next card is also 1, is only 3/4 of the chance that the second card is 2,3 or any other number. Hence, one would guess on the number 1, on the second card.

However, we cannot keep guessing 1, since a second one will eventually appear.

My strategy would be as follows: If there is no duplicate among the cards we've seen, randomly guess on one of these numbers, as there are less of those numbers left in the deck. In any other case, randomly choose a card among the ones we've seen, with the greatest multiplicity. Example: if we've seen 1,2,3,4,4,5,5,5,6,6,6 one guess 5 with 50% chance and 6 with 50% chance.

I'll run some tests in Mathematica shortly... EDIT: This code gives that the chance of "failing" to guess correctly, (with my strategy) is approximately 28%. Try to beat that.

DoGuess[] := Module[{RandomGuess, deck, seen, g, top},
    deck = RandomSample@Flatten[Table[{n, n, n, n}, {n, 1, 14}]];
    seen = {};

RandomGuess[s_] := Module[{tally, maxMult, guess},
    If[Length@s == 0, Return[1]];
    tally = Tally[seen];
    maxMult = Max[Last /@ tally];
    guess = First /@ Select[tally, Last@# == maxMult &];
    Return[First@guess];
];

Return@Catch[
    Do[
        g = RandomGuess[seen];
        If[top == g, Throw@0];
        AppendTo[seen, top];
        , {top, deck}];
    1];
];
n = 15000;
N[Total[Table[DoGuess[], {n}]]/n]
share|improve this answer
    
In your example, you don't have to randomize between 5 and 6, just pick one. So, random guess for card 1. Pick the value of card 1 until you have 2 of something else (unless you have paired the first card). That will make the simulation easier. –  Ross Millikan Jun 6 '11 at 17:05
    
Ah, yes, it just felt less symmetric... –  Paxinum Jun 6 '11 at 17:17
add comment

The probability is 0, since using perfect memory, one knows the value of the last card with probability 1.

share|improve this answer
2  
As Aaron says, the aim is to get all wrong, so it is easy to get the last guess (in fact at least the last 12 guesses) wrong. –  Henry Jun 6 '11 at 13:59
    
Ah, I assumed one would like to guess correctly, nvm. –  Paxinum Jun 6 '11 at 16:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.