TheManaDrain.com
October 03, 2025, 12:56:15 pm *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Calendar Login Register  
Pages: [1]
  Print  
Author Topic: Against all odds.  (Read 4242 times)
Kasuras
The Observer
Full Members
Basic User
***
Posts: 323



View Profile
« on: December 16, 2005, 03:23:23 am »

Against all odds.
-by Nathan “Kasuras� Meijer

But suppose you throw a coin enough times... Suppose one day, it lands on its edge.
-Kain to Raziel, Soul Reaver II


In the world of maths, there are a few distributions to calculate chances: normal distribution and Poisson distribution to name a few. But basically, there are 2 types of distribution: discrete and continuous. Discrete is when there is a set amount of probabilities, and continuous is when every number is possible. For example: flipping a coin is of a discrete type, because you either flip heads or tails. And filling a bottle would be a continuous distribution because the average is 33 centiliters, but it is also possible that the bottle gets filled with 33.01, 32.69 or perhaps 34 centiliters.

Because you cannot play with half a card, Magic’s odds are calculated by a discrete distribution. And because you draw cards, and do not put them back: the hypergeometric distribution is used. This is how that distribution works, according to Wikipedia:

Quote
A typical example is the following: There is a shipment of N objects in which D are defective. The hypergeometric distribution describes the probability that in a sample of n distinctive objects drawn from the shipment exactly k objects are defective.

In general, if a random variable X follows the hypergeometric distribution with parameters N, D and n, then the probability of getting exactly k successes is given by



The probability is positive when k is between max{ 0, D + n − N } and min{ n, D }.

A practical example would be the chance of drawing 1 Force of Will in your opening hand:

N = 60 (assuming you are playing 60 cards)
D = 4 (there are 4 FoWs in your deck)
k = 1 (you want to calculate the chance of drawing 1 FoW)
n = 7 (you draw 7 cards in your opening hand)



And that chance is 0.33628. Another example: the chance of drawing at least 1 FoW would be f(1;60,4,7) + f(2;60,4,7) + f(3;60,4,7) + f(4;60,4,7) = 0,3995. Note that this can also be calculated by 1 – the chance of drawing no FoW at all, which is 1-f(7;60,56,7).

But how this all work in the midst of a match? I think it is easily illustrated by an example of a critical decision in the Meandeck Tendrils deck: (This example is assuming the other player does nothing)

Board situation: Mox Sapphire tapped for Ancestral Recall.
In your hand: Brainstorm, Mox Jet, Dark Ritual, Tendrils of Agony, Sol Ring, Cabal Ritual, 2 Spoils of the Vault.
Turn: 1.

What would be the perfect play now? Passing the turn or try to go off this turn? And what would you Spoils for if you would try to go off this turn? And what would you discard if you were to pass the turn? Take a look whether you can go off this turn:

The current storm count is 2, and you have 8 cards in hands of which 1 is Tendrils of Agony; so you can theoretically kill the opponent with that. The problem however is that you cannot cast that Brainstorm with your current situation. So your only option is Spoils: naming a draw spell, hoping you draw into a mana source or naming a mana source itself. The problem is that your choices are quite limited, unless you are the suicidal type, by the nature of most of your mana sources: they are restricted! I will be eliminating all the possibilities one by one to make this clear.

Basically, you have 5 options: Land Grant, Darkwater Egg, Chromatic Sphere, Dark Ritual or Cabal Ritual. Note that your storm count after playing the Spoils and the card you found is 8 and that you have 1BBB in your manapool after playing Spoils and the rest that was in your hand except for the second Spoils, Brainstorm and Tendrils. Let’s start with the chance of finding the cards without losing your 20 life, which is of course equal to 1-the chance of not finding it:

-Land Grant = 1-f(20; 50, 46, 20) = 0,881003.
-Darkwater Egg = 1-f(20; 50, 46, 20) = 0,881003.
-Chromatic Sphere = 1-f(20; 50, 46, 20) = 0,881003.
-Dark Ritual = 1-f(20; 50, 47, 20) = 0,792857.
-Cabal Ritual = 1-f(20; 50, 47, 20) = 0,792857.

And what role do these statistics play when building a deck? One example has already been given earlier in the chance of drawing Force of Will in your opening grip. Let’s take a look at what the chance of drawing at least 1 land in that opening grip is if you were running 21 mana sources in your deck:

1-f(0;60,21,7) = 0,960174.

The problem is that you cannot really do that much with that knowledge; you need something to compare it with. So let’s say you are playing a deck where the optimal number of mana sources in your opening grip is 2. What would then be the optimal number of mana sources to play?

-16 Lands = f(2;60,16,7) = 0,337438
-17 Lands = f(2;60,17,7) = 0,338972
-18 Lands = f(2;60,18,7) = 0,337001
-19 Lands = f(2;60,19,7) = 0,331809

So it is clear that running 17 mana sources in your deck will give you the most chance of getting exactly 2 them in your first 7. Now a more advanced example: the optimal hand in a control deck would exist of a land and a Brainstorm or Ancestral Recall, 2 mana sources or 2 mana sources and Brainstorm or Recall. Let’s say you run 23 mana sources.

-Chance of 2 mana sources in opening grip = f(2;60,23,7) = 0,285551.
-Chance of 1 mana source and Brainstorm or Ancestral Recall = f(1;60,5,7)* f(1;60,23,7) = 0,051962.
-Chance of 2 mana sources and a Brainstorm or Ancestral Recall = f(1;60,5,7)* f(2;60,23,7) = 0,107171.
Total = 0,444684.

Yet again, those chances are not worth that much if you cannot compare them to anything else. So what if you are playing 24 mana sources?

-Chance of 2 mana sources in opening grip = f(2;60,24,7) = 0,269415.
-Chance of 1 mana source and Brainstorm or Ancestral Recall = 0,496354.
-Chance of 2 mana sources and a Brainstorm or Ancestral Recall = 0,644727.
Total = 1,410496

Another example: the chance of drawing 7 mana sources compared to the perfect hand in Gifts. I will be using the list as played by Carl Winter in the 4-30-05 Waterbury Tournament. A hand that would win the game the first turn would look something like this:

-Yawgmoth’s Will
-Time Walk
-Tinker
-Blue mana source
-Black Lotus
-Mana Crypt
-Ancestral Recall

And the chance of that happening is (f(1;60,1,7))^6*f(1;60,16,7) = 3,05221E-07. Compare this to the chance of drawing 7 mana sources in your first 7: f(7;60,25,7) = 0,000896. Indeed, quite a difference.


Oh, remember the example of Meandeck Tendrils where you had to make a decision which card to name? The named card turned out to be 34th in line.
Logged

Ye weep, unhappy ones; but these are not your last tears!
-Frankenstein, -Mary Shelley.

Lasciate ogne speranza, voi ch'intrate.
-The Divine Comedy, -Dante Alighieri
Jacob Orlove
Official Time Traveller of TMD
Administrator
Basic User
*****
Posts: 8074


When am I?


View Profile Email
« Reply #1 on: December 16, 2005, 11:15:32 am »

One note: you can't add the odds of getting X mana sources with the odds of getting X mana sources plus Y other cards, because those sets overlap. In fact, the odds that you will draw (2 lands OR 2 lands and a Brainstorm) are exactly equal to the odds of drawing (two lands).
Logged

Team Meandeck: O Lord,
Guard my tongue from evil and my lips from speaking guile.
To those who slander me, let me give no heed.
May my soul be humble and forgiving to all.
Bram
Adepts
Basic User
****
Posts: 3203


I've got mushroom clouds in my hands


View Profile
« Reply #2 on: December 20, 2005, 01:17:50 pm »

Jacob's point is illustrated by the following paragraph:

Quote
-Chance of 2 mana sources in opening grip = f(2;60,24,7) = 0,269415.
-Chance of 1 mana source and Brainstorm or Ancestral Recall = 0,496354.
-Chance of 2 mana sources and a Brainstorm or Ancestral Recall = 0,644727.
Total = 1,410496

...which is ofcourse nonsense. You've calculated the odds are >1, so it would be impossible not to draw either (2 mana sources), (1 mana source and a brainstorm), or (2 mana sources and a brainstorm). Let me tell you it's quite possible to draw an opening hand that has none of the above. The only way you can have the odds of drawing any one card on opening hand be larger than 1, is to run 54 copies of that one card.
Logged

<j_orlove> I am semi-religious
<BR4M> I like that. which half of god do you believe in?
<j_orlove> the half that tells me how to live my life
<j_orlove> but not the half that tells me how others should live theirs

R.I.P. Rudy van Soest a.k.a. MoreFling
Kasuras
The Observer
Full Members
Basic User
***
Posts: 323



View Profile
« Reply #3 on: December 20, 2005, 02:43:27 pm »

Jacob's point is illustrated by the following paragraph:

Quote
-Chance of 2 mana sources in opening grip = f(2;60,24,7) = 0,269415.
-Chance of 1 mana source and Brainstorm or Ancestral Recall = 0,496354.
-Chance of 2 mana sources and a Brainstorm or Ancestral Recall = 0,644727.
Total = 1,410496

...which is ofcourse nonsense. You've calculated the odds are >1, so it would be impossible not to draw either (2 mana sources), (1 mana source and a brainstorm), or (2 mana sources and a brainstorm). Let me tell you it's quite possible to draw an opening hand that has none of the above. The only way you can have the odds of drawing any one card on opening hand be larger than 1, is to run 54 copies of that one card.

Yes, I realized this when writing the article but I somehow forgot to edit it out before I entered it. I guess I should have calculated it like this:

1-chance of not drawing any of these combinations.


Nonetheless, that was not the point of the article. The article's layout is easily summarized:

-A few chances of various things happening.
-The final sentence.

Quote
Oh, remember the example of Meandeck Tendrils where you had to make a decision which card to name? The named card turned out to be 34th in line.


The point of the article was to make clear that people should use odds as guidelines but should still keep track of the bigger picture; the game is still a random one.

Perhaps I took a bit too much artistic liberty, although I'm not sure whether you indeed didn't understand that this was my point. If that is the case, then I guess I should have made it more clear with added paragraphs and an explanation why I felt this way.
Logged

Ye weep, unhappy ones; but these are not your last tears!
-Frankenstein, -Mary Shelley.

Lasciate ogne speranza, voi ch'intrate.
-The Divine Comedy, -Dante Alighieri
Bram
Adepts
Basic User
****
Posts: 3203


I've got mushroom clouds in my hands


View Profile
« Reply #4 on: December 20, 2005, 06:39:46 pm »

Quote
1-chance of not drawing any of these combinations.

Exactly.

Quote
Nonetheless, that was not the point of the article.

No, I got that. And I somehow neglected to mention that I like your post. You show a grasp of the statistics behind the game well above that of most people I talk to. For example, I have to explain that the odds of drawing a FoW on opening had are not 7*(4/60) at least once a month Wink

It was a minor nitpick, and you made some valid points.
Logged

<j_orlove> I am semi-religious
<BR4M> I like that. which half of god do you believe in?
<j_orlove> the half that tells me how to live my life
<j_orlove> but not the half that tells me how others should live theirs

R.I.P. Rudy van Soest a.k.a. MoreFling
Kasuras
The Observer
Full Members
Basic User
***
Posts: 323



View Profile
« Reply #5 on: December 21, 2005, 10:26:20 am »

Quote
1-chance of not drawing any of these combinations.

Exactly.

Quote
Nonetheless, that was not the point of the article.

No, I got that. And I somehow neglected to mention that I like your post. You show a grasp of the statistics behind the game well above that of most people I talk to. For example, I have to explain that the odds of drawing a FoW on opening had are not 7*(4/60) at least once a month Wink

It was a minor nitpick, and you made some valid points.

For reference, this is what you are calculating with 7*(4/60):

Put simple: you are calculating the chance of drawing Force of Will if you would draw a card, and then would put it back. In game terms: that's the chance of mulliganing to 1 card, and then mulliganing 6 times again and getting a Force of Will in one of those 7 hands with 1 card in it.

A little simplified:

Imagine you have a basket with 60 apples in it. 4 of those apples are green, and 56 of them are red. What is the chance of  picking an apple at random, and that apple being a green one? Exactly; 4/60. What is the chance of picking an apple at random, putting it back in and then picking a new random apple again, and with this picking 7 apples in total? 7*(4/60)! Why? Because the chance of drawing a green apple is 4/60 everytime that you repeat this experiment.
Logged

Ye weep, unhappy ones; but these are not your last tears!
-Frankenstein, -Mary Shelley.

Lasciate ogne speranza, voi ch'intrate.
-The Divine Comedy, -Dante Alighieri
Sylvester
Full Members
Basic User
***
Posts: 68

29847563
View Profile
« Reply #6 on: December 21, 2005, 12:56:06 pm »

Just to complete what Kasuras wrote.

However, when drawing cards from a deck, each card drawn affects the odds of the next draw (the ratio of say, FoW:rest is always different, whether you draw a FoW or something else), hence the complexificationation.

Also, the odds can never be >1. Even if have 55 of the same cards, you'll only hit a [negative integer]!, and factorial is undefined over negative integers.
Logged
Bram
Adepts
Basic User
****
Posts: 3203


I've got mushroom clouds in my hands


View Profile
« Reply #7 on: December 21, 2005, 01:03:32 pm »

Yeah, that's what I meant. In the case of 55 copies of the same card, the odds are 1 exactly, not >1.
Logged

<j_orlove> I am semi-religious
<BR4M> I like that. which half of god do you believe in?
<j_orlove> the half that tells me how to live my life
<j_orlove> but not the half that tells me how others should live theirs

R.I.P. Rudy van Soest a.k.a. MoreFling
Kasuras
The Observer
Full Members
Basic User
***
Posts: 323



View Profile
« Reply #8 on: December 21, 2005, 02:27:26 pm »

Quote
Let there be n ways for a "good" selection and m ways for a "bad" selection out of a total of n+m possibilities. Take N samples and let x_i equal 1 if selection i is successful and 0 if it is not. Let x be the total number of successful selections,



The probability of i successful selections is then




Because this is a bit vague:

m: bad
n: good
m + n = total
N: number of samples
i: number of good samples

Wikipedia uses another way of formatting:

N: total
D: good
n: number of samples
k: number of good samples

Combining the 2:

m ~ N-D
n ~ D
m + n ~ N
N ~ n
i ~ k

Mathworld uses the following: (see above also)

(m!n!N!(m+n-N)!)/(i!(n-i)!(m+i-N)!(m+n)!)

So we're using the following:

((N-D)!D!n!(N-n)!)/(k!(D-k)!((N-D)+k-n)!((N-D)+D)!

In a more readeable version perhaps:

((N-D)!D!n!(N-n)!)
______________
(k!(D-k)!(N-D+k-n)!(N-D+D)!)

Taking the numbers you proposed:

55 Force of Wills --> D=55
in a 60-card deck --> N=60
drawing 7 cards --> n=7
of which you want exactly 1 card to be a Force of Will --> k=1

Which is:

((60-55)!55!7!(60-7)!)
_________________
(1!(55-1)!(60-55+1-7)!(60-55+55)!)

For readability:

(5!55!7!53)
_________
(1!54!-1!60!)

As you can see, there is a -1! in there. And that is impossible. Therefore, the chance of this happening is non-existant.


Unless... you're going to use i as a number? :lol:

Edit: http://mathworld.wolfram.com/HypergeometricDistribution.html = source.
Logged

Ye weep, unhappy ones; but these are not your last tears!
-Frankenstein, -Mary Shelley.

Lasciate ogne speranza, voi ch'intrate.
-The Divine Comedy, -Dante Alighieri
Bram
Adepts
Basic User
****
Posts: 3203


I've got mushroom clouds in my hands


View Profile
« Reply #9 on: December 21, 2005, 05:23:16 pm »

Don't push your luck, Kas Smile
Logged

<j_orlove> I am semi-religious
<BR4M> I like that. which half of god do you believe in?
<j_orlove> the half that tells me how to live my life
<j_orlove> but not the half that tells me how others should live theirs

R.I.P. Rudy van Soest a.k.a. MoreFling
Machinus
Keldon Ancient
Full Members
Basic User
***
Posts: 2516



View Profile
« Reply #10 on: December 21, 2005, 05:54:07 pm »

Here is the formula I use:

Logged

T1: Arsenal
Bram
Adepts
Basic User
****
Posts: 3203


I've got mushroom clouds in my hands


View Profile
« Reply #11 on: December 21, 2005, 07:01:18 pm »

Here's the formula I use:

Quote
=HYPERGEOMDIST(N;Z;X;Y)

Excel ftw.

Logged

<j_orlove> I am semi-religious
<BR4M> I like that. which half of god do you believe in?
<j_orlove> the half that tells me how to live my life
<j_orlove> but not the half that tells me how others should live theirs

R.I.P. Rudy van Soest a.k.a. MoreFling
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.13 seconds with 21 queries.