Welcome to Gaia! ::


Familiar Phantom

Thought I'd share some knowledge about using discrete math to help you get the cards you want in your starting hand. I will show you how to:

  • Calculate the chance that you will pull at least one of a certain type of card in your starting hand
  • Calculate the chance that you will start a game with at least one card of a certain type IF you always redraw your hand if you don't get a card of that type in your first starting hand
  • Calculate the chance that your starting hand will contain at least one card each of two different types, and calculate the chance of starting the game with such a combination of cards IF you always redraw your hand if you don't start with it.

For example say you want a 90% chance of having a 12 mana card in your deck at the start of each game. I'll show you how to calculate how many 12 mana cards you need to put in your deck to get a 90% probability of getting a 12 mana card in your starting hand.

I'll explain the math but if you just want to do it then jump down to the heading USING A HYPERGEOMETRIC CALCULATOR for the easiest 100% accurate way, or to the heading THE 5-1 RULE for an easy way that's not 100% accurate.

Basically, the main question we are trying to answer is: “If I have X number of cards of Y Type, how likely am I to get at least one card of Y type in my starting hand?” The answers to the other questions are built from the answer to that one.

The term "type" here refers to any group of cards. Maybe you want to know how likely you are to get Dragoneye Scout in your starting hand, or maybe you want to get a card that costs less than twelve mana. All that matters is the size of the group of cards, this number is k. You want to know the chance that at least one card from this group is in your starting hand.

TOOLS

The following two resources will be used repeatedly in this post.

Hypergeometric calculator

Wolframalpha

You don't need to know how to use them. I'll explain how to use the hypergeometric calculator, and for Wolframalpha all you have to do is type equations into the box and hit enter to get an answer.

MATH

So you want to know the chance that a card of type Y from your deck will end up in your starting hand. Say your deck has k cards of Y type and n cards total. We're actually going to calculate the chance that your starting hand DOES NOT contain a card of type Y and use that to calculate the chance that it does, because that's quite a bit simpler than doing it the other way around. Remember, you can also use the hypergeometric calculator to quickly do this calculation, and that is explained below under the heading USING A HYPERGEOMETRIC CALCULATOR. If you aren't interested in the actual math you may want to skip down to there.

So when the computer chooses your first card, what is the chance that it chooses a card that is not of type Y? This is just the number of cards that aren't of type Y in your deck divided by the number of cards in your deck, or: (n-k)/n

When the computer chooses the second card, what is the chance that it's not of type Y? The logic is the same, but you've already drawn one card, so this time there are only n-1 cards in your hand and n-k-1 cards in your hand that aren't of type Y, so it's (n-k-1)/(n-1)

For the third card? Same idea: (n-k-2)/(n-2)

See the pattern yet? We need to do this all the way out to the sixth card. Then we multiply all of those probabilities, subtract that from 1 (to convert from the chance of failure to the chance of success), and we then have the answer to our question. This gives us:

FORMULA 1

1 - (n-k)/n * (n-k-1)/(n-1) * (n-k-2)/(n-2) * (n-k-3)/(n-3) * (n-k-4)/(n-4) * (n-k-5)/(n-5)

Where n is the number of cards in your deck and k is the size of the group of cards you want at least one card to be in your starting hand from. This is the chance of you having a card of type Y in your starting hand.

This can be more compactly written as 1 - CAPITAL_PI((n-k-x)/(n-x), x, 0, 5)
(capital PI operator on (n-k-x)/(n-x) for variable x on range 0 to 5)

Which can be entered into Wolframalpha as "1 - product (n-k-x)/(n-x), x=0..5" (use your numbers for n and k, but leave everything else as is, including the x)

But if the capital pi stuff is scary just use the first form of the formula, they all are equivalent.

I have satisfied myself that this is correct by playing 50 very anticlimactic games against Mage Orion during which I drew 100 opening hands (redrawing my hand at the start of each game) My deck contained 4 cards that were worth 12 mana or less and 35 cards total (k = 4, n = 35). According to formula 1, I should have had at least one 12 mana card in 55% of my starting hands. Out of the 100 starting hands, 58 contained at least one card worth 12 mana or less. That’s 58% of them.

This math doesn't have to be restricted to your starting hand. Maybe you don't necessarily need a card of type Y in your starting hand, but you want it to be one of the first 8 cards you draw (including the 6 in your starting hand). Then we'd just change the range of the product function like so: "1 - product (n-k-x)/(n-x), x=0..7" (notice that the range is now 0 to 7 instead of 0 to 5. The high end of the range is the number of cards you draw minus 1)


EXAMPLE 1

I have 35 cards in my deck and I want to know how many 12 mana cards I need in my deck in order for there to be at least one 12 mana card in 90% of my starting hands.

n = 35, k = the variable to solve for (the number of cards we need for 90% chance)

We plug 35 in for n and set formula 1 equal to 90% also known as .90

.9 = 1 - (35-k)/35 * (35-k-1)/(35-1) * (35-k-2)/(35-2) * (35-k-3)/(35-3) * (35-k-4)/(35-4) * (35-k-5)/(35-5)

Use something like Wolframalpha to solve for k. I would love to just give a link to the result on Wolframalpha but Gaia screws the link up somehow. So just go to Wolframalpha and copy the equation into the box and look at what variable k evaluates to in the "real solutions" pane (scroll down a little).

The answer is k = 10.3. I would need about 10 cards worth 12 mana or under in order for there to be a 90% chance of me drawing at least one such card in my starting hand.

If you want something more compact you can use this without the quotes in Wolframalpha instead: ".9 = 1 - product (35-k-x)/(35-x), x=0..5" , it will give the same answer but there's less typing involved.

You may see that 54.7 is also an answer. This is basically a consequence of this being a sixth-degree equation, so there will be one answer with k < n and another with k > n. Of course, only the lower answer is valid, as you can't put more cards of type Y in your deck than there are cards in your deck!


WHAT IF I DRAW TWO STARTING HANDS?

Maybe you want to know the chance of getting at least one card of type Y in your starting hand even if it means redrawing your hand. If you don't get a card of type Y in your first starting hand, you redraw. If you do have a card of type Y in your first starting hand, you do not redraw. Doing this, what is the chance that you will begin the game with a card of type Y?

Four possibilities:
1. Your first and second starting hands both have a card of type Y (only a theoretical possibility, won't ever actually happen since you only redraw if your first starting hand has no card of type Y)
2. Your first starting hand has a card of type Y but your second doesn't.
3. Your second starting hand has a card of type Y but your first doesn't.
4. Neither of your starting hands have a card of type Y

We want either possibility 1, 2 or 3 to happen. Possibility 4 is failure.

First we use formula 1 above or the hypergeometric calculator below to calculate the chance that your first starting hand has at least one card of type Y. We call this chance P. Using P, we can calculate the possibility for each of the four possibilities above.

How likely is each of the above possibilities to happen?
1. P^2
2. P * (1-P)
3. (1-P) * P
4. (1-P)^2

So then how likely is it that one of the success possibilities will happen? It one minus the probability of case 4 (or the probabilities of cases 1 to 3 added together, but subtracting the probability of case 4 from 1 is easier). This gives us:

FORMULA 2

1 - (1-P)^2

This is the chance that you will start the game with a card of type Y. So to recap on how to use it, you first calculate the chance that a card of type Y will appear in your first starting hand (see formula 1 or the section about using a hypergeometric calculator), and then you use formula 2 with P equal to that chance. This gives you the chance that you will start the game with at least one card of type Y but only if you redraw your hand in the case that you do not have a card of type Y in your first starting hand, that's what's different here from the above section.

EXAMPLE 2

I have 4 12 mana cards in my deck, and 35 cards total. I use formula 1 to calculate the chance of a starting hand having at least one 12 mana card, with the variables in the formula: k = 4 and n = 35:

1 - product (35-4-x)/(35-x), x=0..5

I put that into Wolframalpha and it comes out to be about .55 or 55%

Then we just apply formula 2: 1 - (1-P)^2 with P = .55:

1 - (1 - .55)^2

And that equals .80 I have an 80% chance of beginning the game with at least one 12 mana card if I redraw my hand when I don't have a 12 mana card in it.

FORMULA 3

This is just a combination of formula 1 and formula 2 (substituting formula 1 for P in formula 2), and you could use it to more quickly do example 2. I will only write it in Wolframalpha language because it will look really scary otherwise. It is:

1-(1-(1 - product (n-k-x)/(n-x), x=0..5))^2

This is the chance of you starting a game with a card of type Y if you redraw in the case that your first starting hand does not contain a card of type Y. Instead of the two-step process in example 2, we can just use formula 3: 1-(1-(1 - product (35-4-x)/(35-x), x=0..5))^2 Tada! Same answer, less work. Just remember to substitute your own numbers instead of 35 and 4, but leave the x alone.

WHAT IF I HAVE TWO TYPES OF CARDS AND I WANT ONE OF EACH

So you have two groups of cards, the cards of type Y and the cards of type Z. You have k cards of both types. Your deck contains n cards total. What is the likelihood that your first starting hand will contain at least one card of type Y and one card of type Z?

In order to save us some of trouble, we’re going to require that the number of cards of both types in your deck be equal (for example, you have 4 attuners and 4 12 mana cards). If you really don’t want that restriction, let me know, but it requires a lot more calculations, and I wouldn’t think it would be very helpful.

So there are four cases here too:
1. Your starting hand contains at least one card of type Y but none of type Z
2. Your starting hand contains at least one card of type Z but none of type Y
3. Your starting hand contains no cards of type Y or Z
4. Your starting hand contains at least one card of type Y and one of type Z

You want case 4 to happen. Cases 1, 2, and 3 are failures. We only care about case 4, and this time, we can calculate that directly without too much trouble. So what is the chance that case 4 will occur?

Well, case 4 can be described like so: at least one of my six starting cards is of either type Y or Z, and at least one of the remaining five starting cards is of the other type. This involves two probabilities:

P1: This is the probability that at least one of your six starting cards is of type Y or Z. Use the hypergeometric calculator with population size = n, successes in population = k, sample size = 6, number of successes in sample = 1. (or formula 1)

P2: This is the probability that one of your remaining 5 starting cards is the other type. Use the hypergeometric calculator with population size = n-1, successes in population = k, sample size = 5, number of successes in sample = 1. (formula 1 does not work for this one because there are only 5 cards left to pick instead of 6, but if you're feeling adventurous, you could modify formula 1 so that it works here!)

You want both of these possibilities to happen together, so once you calculate them, you multiply them:

P1 * P2

This is the chance that your starting hand will contain at least one card of type Y and one card of type Z. Recap: use the instructions above to calculate P1 and P2, and then multiply them together.

I have satisfied myself that this is correct by playing 50 very anticlimactic games against Mage Orion during which I drew 100 opening hands (redrawing my hand at the start of each game) My deck contained 4 cards that were worth 12 mana, 4 attuners, and 38 cards total (k = 4, n = 38 ). According to the method above, I should have had at least one 12 mana card AND at least one attuner in 23.296% of my starting hands. Out of the 100 starting hands, 28 were successes. That’s 28% of them. I did a chi-squared test to make sure those results are good and they are.

So what if you want both a card of type Y and of type Z so badly that you’ll redraw if you don’t get at least one of both? This is very similar to the situation where we only have one type of card. Use the method above to calculate the chance that you’ll have both a card of type Y and a card of type Z in your starting hand. That probability is P. Plug that into: 1 – (1 – P)^2. This gives you the chance that you will start the game with at least one card of type Y and one card of type Z but only if you redraw your hand in the case that you do not have a card of type Y and a card of type Z in your first starting hand, that's what's different here from above and why the 1 – (1 – P)^2 comes into play.

If you start doing this math, you will notice that you need quite a few cards of type Y and Z in order to get a good chance of starting the game with at least one card from both groups. For example, if my deck has 40 cards and I want to start with an attuner and a 12 mana card, I will need 8 attuners and 8 12 mana cards in order to get an 80% chance of that happening. This math can also be generalized to more groups of cards (for example, you want an 80% chance of getting at least one card from groups X, Y, and Z) but with more than two groups of cards, you'd need such a large k (the number of cards in each group) that you'd hardly have room for much else. Having a good chance of getting one each of two types of cards is expensive!


EXAMPLE 3

I have 4 12 mana cards in my deck, 4 attuners, and 35 cards total. I use the hypergeometric calculator to calculate the two probabilities like so:

P1:
35 for population size (this is my deck size)
4 for number of successes in population (this is the number of 12 mana cards or attuners in my deck)
6 for sample size (this should ALWAYS be 6 for this calculation)
1 for number of successes in sample (this should ALWAYS be 1 for this calculation)

This comes out to be about .546 (the calculator gives you 5 answers, you only care about the last one, which is labeled "Cumulative Probability: P(X > 1)", in this case that one is .546)

P2:
34 for population size (this is my deck size minus 1)
4 for number of successes in population (this is the number of 12 mana cards or attuners in my deck)
5 for sample size (this should ALWAYS be 5 for this calculation)
1 for number of successes in sample (this should ALWAYS be 1 for this calculation)

This comes out to be about .487

Now I multiply P1 and P2 and that equals about .27 also known as 27%. So in 27% of my starting hands I’ll get both a 12 mana card and an attuner.

What if I agree to redraw my hand if I don’t get an attuner and a 12 mana card? In what percentage of games will I start with with at least one attuner and at least one 12 mana card?

We use formula 2 with P equal to .27:

1 – (1 - .27)^2 = about .47 also known as 47%

So, if I redraw my hand when I don’t have both an attuner and a 12 mana card, I’ll start 47% of games with an attuner and a 12 mana card.

USING A HYPERGEOMETRIC CALCULATOR (EASIER WAY)

(Ginnjii showed me this)

Use this calculator

1. I have k cards in my deck of type Y, and n cards total. I want to know the chance that my first starting hand contains a card of type Y, so I...

Using the calculator linked to above, enter n for population size, k for number of successes in population, 6 for sample size, and 1 for number of successes in sample. Hit calculate. The bottom number, the cumulative probability of P(X >= 1), is the chance of my first starting hand containing at least one card of type Y.

2. I have k cards in my deck of type Y, and n cards total. I want to start the game with a card of type Y so badly that I'll redraw my hand if my first starting hand does not contain a card of type Y. I want to know the chance that, doing this, I will start the game with a card of type Y, so I...

Do the calculation above in part 1 to get the the cumulative probability of P(X >= 1) (this is the probability that your first starting hand has a card of type Y). Call this probability P. Now use formula 2 which is...

1 - (1-P)^2

This is the chance that I will start the game with at least one card of type Y.

3. I have two types/groups of cards and I want to know the chance that at least one card from each group is in my starting hand. See heading WHAT IF I HAVE TWO TYPES OF CARDS AND I WANT ONE OF EACH.

This doesn't have to be restricted to your starting hand. Maybe you don't necessarily need a card in your starting hand, but you want it to be one of the first 8 cards you draw (including the 6 in your starting hand). Then in the calculator, we'd enter 8 for sample size instead of 6. The sample size is the number of cards you draw, and the calculator returns the chance that a card of type Y is in that set of cards.


Do you want at least two cards of type Y in your starting hand? Then in the calculator, enter 2 for "number of successes in sample". But be warned, you'll need a LOT of cards of type Y to get a good chance of getting at least 2 of them in your starting hand! With a 35 card deck it would be around 10-12 cards of type Y depending on how good you want your chance to be.


EXAMPLE 4

I have 4 12 mana cards in my deck, and 35 cards total. I want to know the chance that my first starting hand contains a card that I can summon for 12 mana.

I use this calculator and enter:

35 for population size (this is my deck size)
4 for number of successes in population (this is the number of 12 mana cards in my deck)
6 for sample size (this should ALWAYS be 6 for this calculation, unless you're doing something described in a spoiler above)
1 for number of successes in sample (this should ALWAYS be 1 for this calculation, unless you're doing something described in a spoiler above)

I hit calculate and look at the last number (the the cumulative probability of P(X >= 1)). It is .55 or 55% I have a 55% chance of drawing at least one 12 mana card in my first starting hand. This number is P.

But say I decide that I will redraw my hand if I do not get at least one 12 mana card in my starting hand. What is the chance that I will start the game with at least one 12 mana card?

Using 1 - (1 - P)^2:

1 - (1 - .55)^2

Which is about .8 or 80%. If I always redraw my hand when I don't start with a 12 mana card, then I have an 80% chance of starting the game with a 12 mana card (8 out of 10 games you play you will begin with a 12 mana card).

Maybe I don't like that. Maybe I want a 90% chance of success. Then using the calculator, I can play around with the "number of successes in population" number and plug the probabilities into formula 2. Eventually I do the math with 7 as my number of successes in population and see that that gives me a 91% chance of starting the game with a 12 mana card. So then I need 7 12 mana cards in my deck for a 91% chance of starting the game with at least one (I redraw if I don't start with one). I would however recommend using formula 3 to do this, since there is no trial and error involved in that.

For an example of situation 3 (I have two types/groups of cards and I want to know the chance that at least one card from each group is in my starting hand) check EXAMPLE 3.

THE 5-1 RULE (REALLY EASY)

This is as easy as it gets, but it's not 100% accurate.

First, choose your card of type Y and decide how often you want that card to appear in your starting hand. If the answer is somewhere between 60% and 90%, you can use this rule.

Pretend for a second that your deck has 30 cards. If you want the card to appear in...

  • 60% of your starting hands, then you need 4 cards of type Y
  • 70% of your starting hands, then you need 5 cards of type Y
  • 80% of your starting hands, then you need 7 cards of type Y
  • 90% of your starting hands, then you need 9 cards of type Y

But your deck doesn't have 30 cards. That's where the 5-1 rule comes in. For every 5 cards over 30 that your deck has, you need one additional card of type Y. So for example, if your deck has 45 cards and you want an 80% chance of having a card of type Y, you would put 10 cards of type Y in your hand instead of the 7 that you would if your deck had 30 cards. Because 45 is 15 more cards than 30. If you had 35 cards in your deck you would need 8 cards of type Y, if you had 40 you'd need 9 cards of type Y, and 45 requires 10 cards of type Y.

(If the number of cards in your deck isn't divisible by 5, you can just pretend it is. So if you have 33 cards in your deck and you want an 80% chance of drawing a certain card of type Y, you can either pretend your deck has 30 cards and put 7 cards of type Y in it (this will give you a little lower than 80% chance) or you can pretend your deck has 35 cards and put 8 cards of type Y in it (this will give you a little higher than an 80% chance))

Perhaps you are wondering if there is a similar rule for the case where you're allowed to redraw your hand. In case you didn't read above at all, you do this at the start of the game: if your starting hand contains a card of type Y, you do not redraw your hand. If your starting hand does not contain a card of type Y, you do redraw your hand. The 5-1 rule only works with how likely a card is to appear in your very first starting hand. But what if you want that card so badly that you'll redraw if you don't have it? What is the chance then that one of your two starting hands contains the card? I present...

THE 10-1 RULE

You probably already know what this is going to look like. Once again, pretend there are 30 cards in your deck. If you want the card to appear at the start of...

  • 60% of your games, then you need 2 cards of type Y
  • 70% of your games, then you need 3 cards of type Y
  • 80% of your games, then you need 4 cards of type Y
  • 90% of your games, then you need 5 cards of type Y

But your deck doesn't have 30 cards. That's where the 10-1 rule comes in. For every 10 cards over 30 that your deck has, you need one additional card of type Y. So for example, if your deck has 50 cards and you want an 80% chance of having a card of type Y, you would put 6 cards of type Y in your hand instead of the 4 that you would if your deck had 30 cards. Because 50 is 20 more cards than 30. If you had 40 cards in your deck you would need 5 cards of type Y, if you had 50 you'd need 6 cards of type Y, and 60 requires 7 cards of type Y.

(If the number of cards in your deck isn't divisible by 10, you can just pretend it is. So if you have 35 cards in your deck and you want an 80% chance of drawing a certain card of type Y, you can either pretend your deck has 30 cards and put 4 cards of type Y in it (this will give you a little lower than 80% chance) or you can pretend your deck has 40 cards and put 5 cards of type Y in it (this will give you a little higher than an 80% chance))

Blessed Tactician

11,250 Points
  • Beta Contributor 0
  • Beta Critic 0
  • Contributor 150
Why I like computer science more than Math:

In math, you have to know that s**t to have any idea what's going on.
In computer science, you don't, but you'll get the right answer anyway through doing what you do.

Familiar Phantom

Divine_Malevolence
Why I like computer science more than Math:

In math, you have to know that s**t to have any idea what's going on.
In computer science, you don't, but you'll get the right answer anyway through doing what you do.


I'm a comp sci major biggrin

Unforgiving Warlord

9,050 Points
  • Risky Lifestyle 100
  • Noob wrangler 100
  • Brandisher 100
math major reporting!

Destructive Bunny

This thread already has downvotes? Must be the m word xd

Combative Businessman

Someone really needs to use factorials in his explanations.
sweatdrop

Fashionable Conversationalist

14,150 Points
  • Full closet 200
  • Signature Look 250
  • Elocutionist 200
burning_eyes

Conversationalist

I simply use hypergeometric calculators like this one after someone showed it to me.

I find it much easier to be honest.

Familiar Phantom

Ginnjii
I simply use hypergeometric calculators like this one after someone showed it to me.

I find it much easier to be honest.



Gah I was looking for something like that but didn't know what it would be called. Added a section explaining how to use it.

Familiar Lunatic

Mmm, tasty.

Shameless Noob

15,000 Points
  • Invisibility 100
  • Peoplewatcher 100
  • Ultimate Player 200
Lol I just use the calculator Ginji linked. xd Much faster. rofl

Destructive Bunny

I'm liking all the additions you added since first posting it 3nodding
I don't have to care cause I have an infinite amount of mana.

Conversationalist

Zerakl the Queen
I don't have to care cause I have an infinite amount of mana.


Which is why you get farmed like an essence tree.

Questionable Hero

24,325 Points
  • Healer 50
  • 20 Wins 100
  • Hunter 50
Zerakl the Queen
I don't have to care cause I have an infinite amount of mana.
That's a lie.

Quick Reply

Submit
Manage Your Items
Other Stuff
Get GCash
Offers
Get Items
More Items
Where Everyone Hangs Out
Other Community Areas
Virtual Spaces
Fun Stuff
Gaia's Games
Mini-Games
Play with GCash
Play with Platinum