2
\$\begingroup\$

Let's say I have a deck of n cards (e.g. 50), and will draw x cards from it (e.g. 5). I also have a few combos that are derived from combining two or more cards, and want to know if at least one of them was found in my hand.

For example, let's say my decklist looks like this:

Card A x3
Card B x3
Card C x1
Card D x43

and I have a few combos:

Combo 1
Card A + Card B

Combo 2
Card B + Card C

Combo 3
Card A + Card D + Card D

Thus, one possible hand that would be considered successful is Card A, Card A, Card D, Card B, Card A, since Combo 1 is in that hand.

I've ran a simulation like this across 10,000 different hands, and the percentage of drawing at least one combo has ranged from 7% to 12%. Obviously luck is a factor here, but is there a way for me to calculate an "average" chance that is static? I don't know much about statistics, so I'm not sure how to give proper feedback about these data.

\$\endgroup\$

1 Answer 1

5
\$\begingroup\$

To compute the probability of a success, we count how many ways a success can happen, and divide by how many ways anything could happen. That gives us the fraction of all the anythings that are a success.

In this case, our "anythings" are all the possible 5-card hands drawn from a 50 card deck. If we sort the cards in our hand before counting, so the order of dealing doesn't matter (this keeps our numbers a bit smaller), we can use the Combinations function to compute this. You'll see this written various ways:

$$ n C k = Choose(n, k) = \binom n k = \frac {n!} {k!(n-k)!}$$

...or in spreadsheet software like Excel or Google Sheets as COMBIN(n, k). It's the number of unordered subsets of size \$k\$ that can be made from an initial set of size \$n\$.

For our total hands, that's COMBIN(50, 5) = 2 118 760.

To make a combo, we're restricting our choices for part of the hand.

There are 6 families of ways to make Combo 1 (at least 1 A and at least 1 B), where X stands for any of the 44 cards that are neither A nor B:

  • A B X X X: COMBIN(3, 1) * COMBIN(3, 1) * COMBIN(44, 3) = 119 196
  • A A B X X: COMBIN(3, 2) * COMBIN(3, 1) * COMBIN(44, 2) = 8 514
  • A A A B X: COMBIN(3, 3) * COMBIN(3, 1) * COMBIN(44, 1) = 132
  • A A A B B: COMBIN(3, 3) * COMBIN(3, 2) * COMBIN(44, 0) = 3
  • A A B B X: COMBIN(3, 2) * COMBIN(3, 2) * COMBIN(44, 1) = 396
  • A B B X X: COMBIN(3, 1) * COMBIN(3, 2) * COMBIN(44, 2) = 8 514
  • A B B B X: COMBIN(3, 1) * COMBIN(3, 3) * COMBIN(44, 1) = 132
  • A A B B B: COMBIN(3, 2) * COMBIN(3, 3) * COMBIN(44, 0) = 3

So in total that's 136 890 ways to make that combo. Dividing by our total number of hands that's a 6.46085% probability.

We can use a spreadsheet like this one to repeat the calculation for each of the other combos:

Spreadsheet linked above

That gives us these probabilities:

  • Combo 1 P(A >=1 && B >= 1) = 6.46085%
  • Combo 2 P(B >=1 && C >= 1) = 2.29809%
  • Combo 3 P(A >=1 && D >= 2) = 27.53205%

Now if we just add all these up, we'll get an over-estimate, because we're counting some hands that contain more than one of these combos. So we also need those probabilities:

  • Combo 1 AND 2: 0.42081%
  • Combo 1 AND 3: 6.39289%
  • Combo 2 AND 3: 0.38357%
  • All Combos: 0.38357%

So, the probability a hand has at least one combo is the sum of the three single-combo probabilities, minus the three double-combo probabilities (eliminating the double-counts), plus the triple-combo probability (since subtracting the double-counts subtracted all three of our initial counts of these hands, we need to add them back in). That gives 29.47729%.

\$\endgroup\$
7
  • \$\begingroup\$ Thank you for your very complete answer. I'm just wondering if the final step in which you calculate all possible combination of combos can be done by using the probabilities of drawing the individual combos (i.e. Combo 1 = 6.4%), or if I have to use an approach similar to the one presented when initially calculating the probability of drawing each individual combo (COMBIN(n, k) * COMBIN(n, k)...) \$\endgroup\$ Mar 13, 2022 at 6:29
  • 1
    \$\begingroup\$ The probability of the combos overlapping is non-uniform. You'll notice that even though combo 3 makes up just 28% of all hands, 99% of combo 1 hands also contain a combo 3 (since D is the most common card to fill the gaps with). So you do have to account for this internal detail when computing the 4 combined probabilities. \$\endgroup\$
    – DMGregory
    Mar 13, 2022 at 12:16
  • \$\begingroup\$ I am revisiting this answer because I would like to try implementing this in code, but am having an issue iterating through all of the combo possibilities (the step where you discuss the "families" of the first combo). Could you point me in the right direction? \$\endgroup\$ Dec 21, 2022 at 10:49
  • 1
    \$\begingroup\$ That's worth posting as its own question, either on here, or on StackOverflow (just choose one). My best guess off the top of my head is that you could use Combinatorial numbers to iterate over the distinct subsets of "[Deck Size] choose [Hand Size]", then bucket them by which combos they contain. That's tractable enough for small decks/hands. I notice that page also links to another one exploring ways to enumerate combinations in general. \$\endgroup\$
    – DMGregory
    Dec 21, 2022 at 13:50
  • 1
    \$\begingroup\$ Then you subtract the ones that overlap and don't subtract the ones that don't. If you don't have overlap to eliminate then there's no need to adjust for it. If you don't have a multiple-overlap that might get subtracted multiple times, you don't need to add it back to compensate for that. \$\endgroup\$
    – DMGregory
    Dec 23, 2022 at 10:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .