# How do I calculate the odds of any one of several card combinations?

Note: I know what a multivariate hypergeometric calculator is.

Game: Yugioh

The deck size/ population is 44 cards. The hand size is 5. For both of these, I'd like to also calculate the odds for different numbers.

The deck has the following variables:

A x 3

B x 3

C x 2

D x 1

E x 3

F x 2

G x 3

H x 3

I x 3

J x 3

K x 3

L x 3

M x 2

Success combinations are as follows:

((A + B)), ((A + C)), ((E + F)), ((G + L)), ((F + E + D)), ((F + B)), ((A + J)), ((E + J)), ((K + J)), ((F + J)), ((B + J)), ((C + J)), ((K + H + A)), ((K + I + A)), ((K + H + F)), ((K + I + F)), ((K + H + E)), ((K + I + E)), ((K + H + B)), ((K + I + B)), ((K + H + C)), ((L + I + C))

Each of these are only successes if I do not draw both M samples

My issue is that a hand can have multiple combo's with an overlapping card; i.e. a hand can have both ((A + B)) and ((A + C)), with either 1 A shared between them, or 2 or 3 A's, for example.

I believe I know exactly what I find out, but I'm unable to articulate it enough to search for it effectively it seems. This should be enough to answer, but if it's easier to know exactly what I'm playing, it's a Dino deck; Animadorned Archosaur x3, Babycerasaurus x3, Petiteranodon x2, Giant Rex x1, Miscellaneousaurus x3, Souleating Oviraptor x2, Scrap Raptor x3, Scrap Chimera x1, Maxx C x3, Ashe Blossom x3, Fossil Dig x3, Terraforming + Lost World x3 (total), and Small World x3. The card I can't draw exactly 2 of Double Evolution Pill, and along with other cards it's 44 total.

• What does it mean to have both `((E + F))` and `((F + E + D))` listed in your success combinations? Jul 24, 2022 at 20:45
• I'm not entirely sure if it is a meaningful difference to be honest Jul 24, 2022 at 21:41
• @ChristopherMcCauley: However, it most certainly will be a meaningful difference in the calculation if the specification is not precise and unambiguous. Jul 25, 2022 at 1:50
• If you are fine with an approximated chance, a simulation that draws your starting hand a few million times and compares against success combinations might work as well Jul 25, 2022 at 10:07
• "The deck size/ population is 44 cards." No, it's not. It adds up to 34.
– Stef
Jun 9, 2023 at 17:26

I wrote a small python script to enumerate all hands and count how many hands were successes. Here are the results:

``````DECK:  AAABBBCCDEEEFFGGGHHHIIIJJJKKKLLLMM
SUCCESSES:  AB AC EF GL FED FB AJ EJ KJ FJ BJ CJ KHA KIA KHF KIF KHE KIE KHB KIB KHC LIC
N CARDS IN DECK:   34
N CARDS IN HAND:   5
HANDS SUCCESSFUL:  218223
TOTAL HANDS:       278256
PROBA OF SUCCESS:  0.7842526306710368
``````

Importantly, note that there are 34 cards in the deck, not 44 as you claim.

Putting aside the part of the script I used to parse your question to build the deck and the reference list of successful combinations, here is the part of the code that makes the computations:

``````from itertools import combinations
from collections import Counter
from math import comb

def is_success(hand, successes_ref):
return (hand['M'] < 2) and any(s <= hand for s in successes_ref)

def count_successes(deck, n_cards_in_hand, successes_ref):
return sum(
is_success(Counter(hand_tuple), successes_ref)
for hand_tuple in combinations(deck, n_cards_in_hand)
)

def total_hands(deck, n_cards_in_hand):
return comb(len(deck), n_cards_in_hand)
``````