8

Suppose 2 people (call them A and B) challenge each other to a card game. A fair, well shuffled, standard 52 card deck is used for each hand. Community (shared) cards are drawn one at a time without replacement for each hand. Player A will win if all four Kings are drawn in a hand. Player B will have a candidate win if a pair of triples are drawn from the following ranks (2,3,4,5,6,7,8,9,10) in a hand. Since it is more likely that B will encounter a candidate win before A wins, both players agree that even if B gets a candidate win (let's say for example with 20 cards drawn so let n = the number of cards drawn for B to have the first candidate win of the hand), community cards will continue to be drawn for that hand until either twice as many cards are drawn and there is no win for A, or A has a win before 2n cards are drawn.

For example: Let's suppose player B gets a candidate win early in the hand at the 10th drawn card (not likely but good to keep this example short). The drawn cards could be something like this: 3 5 K 7 5 J K 3 3 5. Here B has a candidate win with 333 and 555 but the rules of the game state that A has a chance to win by getting the 4 Ks within twice the number of cards drawn when B gets the first candidate win (in this example twice 10 cards = 20 cards). So for example, if drawn cards 11 thru 15 were 9 2 K Q K, then A would actually win because A's win was in 15 cards and B's candidate win was in 10 cards and 15 is less than double of 10. In this case, B's candidate win would lose.

So there will be a winner every hand.

So the question is who will win in the longrun based on the given rules? How do you compute this mathematically? That is, how do you determine the average number of cards for each player to get a candidate win and if we apply these rules of the game, who should win in the longrun?

For clarification, note that quads of ranks 2,3,4,5,6,7,8,9 and 10 are still considered triples. So (for example), B can still have a candidate win if cards 2 2 2 3 3 3 3 are drawn somewhere in the hand before seeing quad Ks. The last card of rank 3 here might be drawn as we are drawing more cards to see if A will have a win within the allowed # of cards. Also, even if more than a 2 occurrences of triples in ranks 2,3,4,5,6,7,8,9,and 10 show up, that is still considered a candidate win for B. For clarity, think of the first pair of triples seen (in ranks 2,3,4,5,6,7,8,9,10) as the start of the candidate win for B (taking note of how many cards were drawn up to that point), and as we draw more cards to see if A wins or not, other triples that come up will not nullify the candidate win that B already has.

Also, in the rare case where the four Ks appear before player B gets the 2 occurrences of triples, the hand would stop immediately since that is clearly a win for player A.

For clarity I should also mention that quads in ranks 2..10 are still considered a candidate win for B such as if cards 2 2 2 2 7 7 7 7 are seen before the 4 Ks are seen. This is because once a triple in ranks 2..10 is seen, it retains the triple "status" (for the purpose of this game), even though it may later turn into a quad during that same hand.

Also note that the minumum # of drawn cards for A to win is 4 (KKKK) but the minimum for B to win is 12 (such as 3 5 3 5 3 5 7 K 8 K 9 K). Even though B has the candidate win at drawn card 6 in this example, we have to allow 12 drawn cards total to ensure there is no win by A within the 12 total cards.

David
  • 1,702
  • The "best" I can probably do with this is to do a computer simulation to get long term averages and maybe run thru some actual cards for some short term. I was wondering if it is enough (mathematically speaking) to just compute the average number of cards for a candidate win for A and B separately and then just compare the 2:1 ratio of them and then pick the overall winner that way or if it is more involved than that. Thanks to all that attempt to solve this rather interesting problem I made up myself and good luck. – David Apr 06 '17 at 00:48
  • For player B, if say four 7's drawn (but no other triple) do we count this as having drawn two triples (since the 7's can be considered in two overlapping sets of 3), or is player B going for xxxyyyuuu.. with x,y distinct and the u's anything? – coffeemath Apr 06 '17 at 12:31
  • 1
    @coffeemath - good point I didn't totally clarify that in my original post. The pattern for B to get a candidate win would be xxxyyyuuu such as 333777K25... although in any order (such as 3737K2573). 7777 (anywhere in the hand) does NOT count as 2 triples since the triples have to be of different ranks and you cannot "overlap" cards. The minumum # of cards for B to have a candidate win would be 6 cards which means the minimum cards for B to win would be 12 (since if A doesn't tie or win by card 12 in that case, B wins that hand). – David Apr 07 '17 at 03:08
  • Also here is an interesting scenario... if B does NOT get a candidate win by drawn card 26, A will win automatically cuz then A would be allowed to use all 52 cards (52 is double 26), therefore A will be guaranteed of getting all 4 K's. So if you are doing some type of computer simulation, if B doesn't have the 2 triples by drawn card 26, just end that hand and give the win to A (unless you are also computing the average # of cards for B to get a candidate win) – David Apr 07 '17 at 03:38
  • By the way, I tried this with a real deck of cards for 1 hand only and I got the pair of trips at card draw 20 but the four Ks didn't come up until card draw 44 so B wins that hand since A needed the 4th K by card draw 40 to win that particular hand. – David Apr 10 '17 at 11:35

2 Answers2

2

Here's a partial answer giving the expected number of cards drawn to get 4 Kings for the first time, and a conceptual answer to the two triplets question.

Notably, the "first time" requirement makes this problem trickier than it looks at first, and is the main complication blocking me from presenting a complete answer with the two triplets.

For 4 Kings, the probability that round $n$ yields the four kings is the probability of having 3 kings at round $n-1$ and drawing the last king at round $n$.

$$p(n) = \frac{1}{52-(n-1)} \times \frac{{48 \choose n-4}}{{52 \choose n-1}}$$

Summing this from $n = 4$ to $52$ yields 0.25, which we use to normalize and find the expectation:

$$\sum_{n=4}^{52} \frac{n \times p(n)}{0.25} = 42.4$$

I confirmed this answer using computer simulations. Incidentally, the expected number of rounds to achieve two triplets is roughly 21.2 by simulation and is the long term winner (barely).


When considering the expected round to achieve two triplets, it's natural to notice that by the pigeonhole principle, it must be less than 37, since it's impossible to not have two triplets by the time the 37th card is drawn. We get this number from 16 (4 cards x 4 face ranks) + 8*2 (8 suits between 2 and 9 with 2 cards each) + 4 (our first triplet with the maximal 4 cards allowed); drawing the 37th card must necessarily complete a second triplet.

I recommend using the above approach, that is, finding $p(n)$ by the product of the probabilities for

  1. the event that at round $n-1$ we don't have two triplets, but it's possible to draw a single card and complete our second triplet

  2. the event that at round $n$ we draw a single card that completes the second triplet

I'll describe the mathematical concepts to answer this problem.

The minimal situation at round $n-1$ can be described using:

$$\binom{9}{1}\binom{4}{3}\binom{8}{1}\binom{4}{2} \times ...$$

This counts the number of ways you can have a "full house" within the 9 non-face ranks. This is the minimal condition at round $n-1$ for it to be possible to complete two triplets by round $n$.

$$\frac{2}{52 - (n-1)}$$

This expression counts the probability of drawing a single card that completes the second triplet, under our minimal condition.

For all the remaining cards, we need to count the number of ways to place them into 4 face ranks and 7 non-face ranks without inducing more non-face triplets. This can be expressed as counting the number of ways you can place $n$ indistinguishable balls into $k$ bins, with a max of $m$ balls per bin (see http://math.stackexchange.com/questions/89417/number-of-ways-to-put-n-unlabeled-balls-in-k-bins-with-a-max-of-m-balls-in for a good reference).

Lastly, for all non-face ranks that we place 2 balls into (draw 2 cards in), we need to adjust the number of winning draws at round $n$ that will complete a second triplet.

Conceptually I believe this should work, but this is a partial answer because I'm having difficulties expressing it all into a single equation that yields the expectation occurring by simulation, 21.2. If I make more progress on this, I'll update this answer.

aesthete
  • 256
  • Right, I was modeling the expected round to hit two triples disregarding if four kings had been drawn, which ought to end the game. – aesthete Apr 07 '17 at 03:35
  • Using some type of "averaging logic", if the best case for getting the 2 triples is only 6 cards and the worst case is 36, "law of averages" (not a mathematical term) would "say" the actual number should be somewhere in the middle (36+6) / 2 = 21. I do not know how to mathematically calculate the average number of cards drawn to get the 2 triples but if I had to guess, I would think it would be around 21 or so, not 34! 34 is way too close to the worst case scenario to be accurate for average case. So if 21 and 42.4 are both accurate, the 2:1 ratio should be very close to "even odds" - @mxwsn – David Apr 07 '17 at 04:19
  • I found and fixed the triplet bug and I get ~21.2 for the expected first round to achieve two triplets. Also, simulating the win condition with 10,000 rounds, it looks like two triplets won 5122 times and four kings won 4537 times, so in the long term two triplets is expected to win more often. There were 341 ties.

    My python code is here: https://pastebin.com/FebxLcAW

    – aesthete Apr 07 '17 at 14:23
  • As a sidenote, my bug was that I was looking for two four-of-a-kinds in the ranks 2-10, instead of two triplets. So if you were curious about that modification, now you know that that answer is 34. :) – aesthete Apr 07 '17 at 14:28
  • Any luck calculating the probability of the 2 triples? Remember they are allowed to turn into quads, and more triples can appear as we are checking for a player A win, but it is the first 2 occurrences of non king triples that count as the candidate win (and # of cards) for determining a winner. @mxwsn – David Apr 11 '17 at 15:56
  • Looks like you "gave up" on trying to figure out how to compute the average number of drawn cards required for the first pair of non king "triples". What happened? @mxwsn – David Apr 13 '17 at 13:36
  • I laid out the mathematical framework for writing down the explicit equation - all the pieces are there, and putting them together is more of a tedious and less of an interesting task. I'm afraid I'm not interested enough in this toy problem to solve it all the way through, especially when a computer simulation can be written in 50 lines of code to get the desired answer. (My background is CS not math) :p – aesthete Apr 13 '17 at 14:11
  • okay, I am a CS person too but was wondering how to solve something like this using math. It seems that many problems of this nature are easy to solve using computer simulation but rather difficult to do using pencil and paper math. However, it is fun (and sometimes challenging) to solve them both ways so that the numbers match. The computer has an advantage in something like this cuz it can "actually" play the game for millions (if not billions) of hands in a short amount of time. It is also interesting to see things like what % of the time the 2nd half of the deck needs be shuffled. @mxwsn – David Apr 13 '17 at 14:58
0

I wrote a complete simulation program to answer this problem. I made the code as simple as possible initially to get it working quickly. I shuffle the entire deck, then I find the candidate win position for A (usually around drawn card 42), then I find the candidate win position for B (usually around drawn card 21). I then check to see if A's position is less than or equal to 2 times B's position. If so, it is a win for A, otherwise it is a win for B. For example, if B's candidate win position is at drawn card 20, then A can win if the 4th king appears at card position 40 or sooner (39,38...). There are no ties there is a winner every hand. This is a slight modification from the original problem but I updated the rules so there are no ties.

I ran my simulation for 10 million wins and got the following results:

$~~~~4,861,266$ : A wins
$~~~~5,138,734$ : B wins

For 200 million wins, (5 hours of simulation), I got this:

$~~97,243,621$ : A wins
$102,756,379$ : B wins

So yes it appears B has a slight advantage in the game. ($51.38$% vs. $48.62$%)

Also, I will be optimizing my code more so it runs faster so I can do more simulations like possibly 1 billion instead of only 10 million. I am using a faster shuffle algorithm now but will improve it even further by only shuffling the first 25 cards because if B doesn't have a candidate win by then, it is an automatic win for A (since A would get to use the entire 52 card deck). Only if B has a candidate win within the first 25 drawn cards will I then shuffle the rest of the deck and check for the 4 kings.

I got the more optimized code working, but unfortunately it is telling me that the "entire" deck (the 2nd chunk) must be shuffled for about 83.75% of the hands so the optimization wasn't as good as I hoped as far as a speedup.

David
  • 1,702