PDA

View Full Version : Land draw - statistical odds



Gui
10-23-2009, 07:54 AM
I've been stressing my computer a bit in order to help me decide my manabase, and I created a program to draw 7, 8, 9 and 10 cards 1000000 times and calculate the % of the time it gets 0, 1, 2, 3 and 4 or more lands on those draws, for a 60 cards deck containing (EDIT) 1~25 lands.

Maybe it was done before, but wanna share the results anyway:

Hand Size: 7
Lands
1: 0: 88,33% 1: 11,67% 2: 0,00% 3: 0,00% 4+: 0,00%
2: 0: 77,84% 1: 20,98% 2: 1,18% 3: 0,00% 4+: 0,00%
3: 0: 68,43% 1: 28,22% 2: 3,24% 3: 0,10% 4+: 0,00%
4: 0: 60,07% 1: 33,59% 2: 5,94% 3: 0,39% 4+: 0,01%
5: 0: 52,54% 1: 37,55% 2: 9,00% 3: 0,88% 4+: 0,04%
6: 0: 45,86% 1: 40,13% 2: 12,29% 3: 1,62% 4+: 0,10%
7: 0: 39,93% 1: 41,61% 2: 15,58% 3: 2,66% 4+: 0,23%
8: 0: 34,56% 1: 42,25% 2: 18,85% 3: 3,92% 4+: 0,42%
9: 0: 30,01% 1: 41,99% 2: 21,83% 3: 5,44% 4+: 0,73%
10: 0: 25,89% 1: 41,16% 2: 24,70% 3: 7,10% 4+: 1,14%
11: 0: 22,30% 1: 39,77% 2: 27,19% 3: 9,04% 4+: 1,71%
12: 0: 19,03% 1: 38,06% 2: 29,33% 3: 11,13% 4+: 2,45%
13: 0: 16,29% 1: 36,11% 2: 31,01% 3: 13,19% 4+: 3,39%
14: 0: 13,88% 1: 33,98% 2: 32,29% 3: 15,36% 4+: 4,49%
15: 0: 11,80% 1: 31,63% 2: 33,10% 3: 17,60% 4+: 5,88%
16: 0: 9,94% 1: 29,28% 2: 33,71% 3: 19,69% 4+: 7,39%
17: 0: 8,33% 1: 26,88% 2: 33,94% 3: 21,66% 4+: 9,18%
18: 0: 7,00% 1: 24,47% 2: 33,71% 3: 23,65% 4+: 11,17%
19: 0: 5,83% 1: 22,17% 2: 33,08% 3: 25,46% 4+: 13,46%
20: 0: 4,84% 1: 19,85% 2: 32,36% 3: 26,99% 4+: 15,97%
21: 0: 3,99% 1: 17,75% 2: 31,33% 3: 28,30% 4+: 18,63%
22: 0: 3,31% 1: 15,69% 2: 30,03% 3: 29,44% 4+: 21,53%
23: 0: 2,66% 1: 13,88% 2: 28,52% 3: 30,20% 4+: 24,74%
24: 0: 2,15% 1: 12,14% 2: 26,99% 3: 30,93% 4+: 27,79%
25: 0: 1,76% 1: 10,56% 2: 25,24% 3: 31,12% 4+: 31,33%
26: 0: 1,39% 1: 9,03% 2: 23,46% 3: 31,23% 4+: 34,89%

Hand Size: 8
Lands
1: 0: 86,70% 1: 13,30% 2: 0,00% 3: 0,00% 4+: 0,00%
2: 0: 74,89% 1: 23,54% 2: 1,57% 3: 0,00% 4+: 0,00%
3: 0: 64,60% 1: 30,97% 2: 4,27% 3: 0,16% 4+: 0,00%
4: 0: 55,51% 1: 36,29% 2: 7,58% 3: 0,60% 4+: 0,01%
5: 0: 47,58% 1: 39,68% 2: 11,30% 3: 1,37% 4+: 0,07%
6: 0: 40,66% 1: 41,49% 2: 15,16% 3: 2,49% 4+: 0,19%
7: 0: 34,62% 1: 42,21% 2: 18,83% 3: 3,92% 4+: 0,41%
8: 0: 29,40% 1: 41,81% 2: 22,29% 3: 5,69% 4+: 0,80%
9: 0: 24,90% 1: 40,70% 2: 25,33% 3: 7,72% 4+: 1,35%
10: 0: 21,02% 1: 39,01% 2: 27,96% 3: 9,94% 4+: 2,08%
11: 0: 17,59% 1: 36,98% 2: 30,04% 3: 12,30% 4+: 3,09%
12: 0: 14,77% 1: 34,55% 2: 31,62% 3: 14,76% 4+: 4,31%
13: 0: 12,27% 1: 31,89% 2: 32,74% 3: 17,17% 4+: 5,93%
14: 0: 10,22% 1: 29,28% 2: 33,31% 3: 19,52% 4+: 7,67%
15: 0: 8,42% 1: 26,69% 2: 33,42% 3: 21,72% 4+: 9,74%
16: 0: 6,91% 1: 24,01% 2: 33,14% 3: 23,74% 4+: 12,21%
17: 0: 5,71% 1: 21,36% 2: 32,40% 3: 25,61% 4+: 14,91%
18: 0: 4,62% 1: 19,04% 2: 31,39% 3: 27,06% 4+: 17,89%
19: 0: 3,75% 1: 16,74% 2: 30,06% 3: 28,36% 4+: 21,09%
20: 0: 3,00% 1: 14,59% 2: 28,45% 3: 29,32% 4+: 24,65%
21: 0: 2,44% 1: 12,63% 2: 26,82% 3: 29,87% 4+: 28,24%
22: 0: 1,92% 1: 10,92% 2: 24,95% 3: 30,20% 4+: 32,02%
23: 0: 1,52% 1: 9,28% 2: 23,00% 3: 30,14% 4+: 36,07%
24: 0: 1,18% 1: 7,85% 2: 21,03% 3: 29,85% 4+: 40,09%
25: 0: 0,92% 1: 6,57% 2: 19,10% 3: 29,19% 4+: 44,23%
26: 0: 0,70% 1: 5,49% 2: 17,07% 3: 28,33% 4+: 48,40%

Hand Size: 9
Lands
1: 0: 85,04% 1: 14,96% 2: 0,00% 3: 0,00% 4+: 0,00%
2: 0: 72,03% 1: 25,98% 2: 1,99% 3: 0,00% 4+: 0,00%
3: 0: 60,81% 1: 33,59% 2: 5,35% 3: 0,24% 4+: 0,00%
4: 0: 51,25% 1: 38,47% 2: 9,38% 3: 0,88% 4+: 0,02%
5: 0: 43,07% 1: 41,17% 2: 13,69% 3: 1,95% 4+: 0,12%
6: 0: 36,03% 1: 42,25% 2: 17,88% 3: 3,51% 4+: 0,33%
7: 0: 30,01% 1: 42,00% 2: 21,86% 3: 5,40% 4+: 0,73%
8: 0: 24,89% 1: 40,69% 2: 25,37% 3: 7,72% 4+: 1,34%
9: 0: 20,57% 1: 38,85% 2: 28,13% 3: 10,24% 4+: 2,22%
10: 0: 16,99% 1: 36,38% 2: 30,34% 3: 12,87% 4+: 3,41%
11: 0: 13,98% 1: 33,52% 2: 31,88% 3: 15,64% 4+: 4,98%
12: 0: 11,34% 1: 30,70% 2: 32,86% 3: 18,22% 4+: 6,89%
13: 0: 9,17% 1: 27,64% 2: 33,17% 3: 20,84% 4+: 9,19%
14: 0: 7,49% 1: 24,71% 2: 32,93% 3: 23,02% 4+: 11,85%
15: 0: 5,93% 1: 21,87% 2: 32,29% 3: 25,08% 4+: 14,83%
16: 0: 4,77% 1: 19,28% 2: 31,12% 3: 26,70% 4+: 18,12%
17: 0: 3,80% 1: 16,72% 2: 29,67% 3: 28,09% 4+: 21,72%
18: 0: 3,01% 1: 14,39% 2: 27,91% 3: 28,96% 4+: 25,73%
19: 0: 2,37% 1: 12,34% 2: 26,10% 3: 29,41% 4+: 29,78%
20: 0: 1,84% 1: 10,44% 2: 23,93% 3: 29,65% 4+: 34,13%
21: 0: 1,46% 1: 8,75% 2: 21,89% 3: 29,25% 4+: 38,65%
22: 0: 1,09% 1: 7,24% 2: 19,72% 3: 28,80% 4+: 43,14%
23: 0: 0,84% 1: 6,02% 2: 17,63% 3: 27,96% 4+: 47,54%
24: 0: 0,64% 1: 4,96% 2: 15,62% 3: 26,65% 4+: 52,12%
25: 0: 0,49% 1: 4,00% 2: 13,70% 3: 25,20% 4+: 56,62%
26: 0: 0,36% 1: 3,20% 2: 11,82% 3: 23,70% 4+: 60,92%

Hand Size: 10
Lands
1: 0: 83,40% 1: 16,60% 2: 0,00% 3: 0,00% 4+: 0,00%
2: 0: 69,27% 1: 28,17% 2: 2,56% 3: 0,00% 4+: 0,00%
3: 0: 57,27% 1: 35,81% 2: 6,56% 3: 0,35% 4+: 0,00%
4: 0: 47,20% 1: 40,21% 2: 11,33% 3: 1,21% 4+: 0,04%
5: 0: 38,81% 1: 42,17% 2: 16,13% 3: 2,70% 4+: 0,19%
6: 0: 31,79% 1: 42,24% 2: 20,75% 3: 4,69% 4+: 0,54%
7: 0: 25,94% 1: 41,07% 2: 24,69% 3: 7,17% 4+: 1,13%
8: 0: 20,98% 1: 39,05% 2: 27,96% 3: 9,92% 4+: 2,10%
9: 0: 16,93% 1: 36,30% 2: 30,41% 3: 12,94% 4+: 3,42%
10: 0: 13,65% 1: 33,17% 2: 32,13% 3: 15,87% 4+: 5,17%
11: 0: 10,86% 1: 30,02% 2: 32,91% 3: 18,76% 4+: 7,45%
12: 0: 8,73% 1: 26,70% 2: 33,05% 3: 21,43% 4+: 10,10%
13: 0: 6,92% 1: 23,57% 2: 32,45% 3: 23,81% 4+: 13,26%
14: 0: 5,43% 1: 20,45% 2: 31,52% 3: 25,88% 4+: 16,72%
15: 0: 4,22% 1: 17,67% 2: 30,02% 3: 27,37% 4+: 20,72%
16: 0: 3,30% 1: 15,11% 2: 28,28% 3: 28,35% 4+: 24,95%
17: 0: 2,55% 1: 12,80% 2: 26,11% 3: 29,03% 4+: 29,51%
18: 0: 1,96% 1: 10,70% 2: 23,92% 3: 29,20% 4+: 34,22%
19: 0: 1,49% 1: 8,85% 2: 21,77% 3: 28,82% 4+: 39,08%
20: 0: 1,15% 1: 7,25% 2: 19,44% 3: 28,22% 4+: 43,94%
21: 0: 0,85% 1: 5,90% 2: 17,13% 3: 27,17% 4+: 48,95%
22: 0: 0,63% 1: 4,77% 2: 14,96% 3: 25,81% 4+: 53,83%
23: 0: 0,46% 1: 3,79% 2: 13,00% 3: 24,10% 4+: 58,64%
24: 0: 0,34% 1: 3,03% 2: 11,13% 3: 22,43% 4+: 63,07%
25: 0: 0,24% 1: 2,36% 2: 9,41% 3: 20,50% 4+: 67,49%
26: 0: 0,18% 1: 1,80% 2: 7,83% 3: 18,55% 4+: 71,65%


(it was spaced properly, but forum cut my spaces)

yugular
10-23-2009, 08:25 AM
Interesting :eyebrow:

Could you also do the same test for 40 card deck? For draft purposes. Is this excel based? I would like to create a similar but also to find out what are the odds to get certain landtypes in multicolour deck.

Thanks for sharing!

libingboy
10-23-2009, 08:27 AM
here's the formula

H = hand size
L = number of lands in deck
D = deck size
n = number of lands in hand

Prob.(Number of lands in hand = n) = (L! / (L-n)! * (D-L)!/(D-L-H+n)!) / (D!/(D-H)!) * (H!/(n!*(H-n)!))

EDIt: formula is for gui_brazil's assumptions (where you just care about the land quantity, not which type of land you want)

if you're working with basic lands only, then it is not that difficult to extend the formula:
for example, islands and forests, where number of islands is L1 and number of forests is L2, with L = L1+L2
Prob.(Number of islands in hand = n1 and number of forests in hand = n2) =
(L1! / (L1-n1)! *L2! / (L2-n2)! * (D-L)!/(D-L-H+n)!) / (D!/(D-H)!) * (H!/(n!*(H-n)!)) where n= n1+n2.

Gui
10-23-2009, 08:30 AM
Interesting :eyebrow:

Could you also do the same test for 40 card deck? For draft purposes. Is this excel based? I would like to create a similar but also to find out what are the odds to get certain landtypes in multicolour deck.

Thanks for sharing!

Hmmm... I certainly could do.
It's Java... I could share the codes...

For your test, just need to know what's the numbers,
40 Cards, x~y Lands, x~y Hand size, and what data you are insterested in, like the % of time 0, 1, 2, 3 and 4+ lands drawn ?


EDIT: Well... the above formula covers it...
EDIT2: Libingboy, do you have Excel tables with those? Could you compare the results?

libingboy
10-23-2009, 08:37 AM
i only tested for hand size of 7, and our values are pretty close. For 10 lands:
n
0 0.258629234
1 0.4114556
2 0.24687336
3 0.071557496
4 0.010657499
5 0.000799312
6 2.71875E-05
7 3.10714E-07

Nessaja
10-23-2009, 08:44 AM
Actually there's a much "easier" formula for excel as you're using the hypergeometric distribution, formula being:
=HYPGEOMDIST([amount of copies you want from the card];[cards drawn];[copies available in deck];[decksize])

Gui
10-23-2009, 08:54 AM
i only tested for hand size of 7, and our values are pretty close. For 10 lands:
n
0 0.258629234
1 0.4114556
2 0.24687336
3 0.071557496
4 0.010657499
5 0.000799312
6 2.71875E-05
7 3.10714E-07

Yet it seems a little suceptible to my randomization source... It should be a lot closer, since I'm running it a milion times...
Gonna research some other randomize strategy...
EDIT: Oh, never mind, IT's REALLY close... think i've looked the wrong hand size o0


Well, although the formula is easier, I'm gonna use the program in a little more customized scenario, that's why I asked for a result check =)


EDIT 2: Just have noticed that lands 1~9 could be used to help with all the other stuff, like duals and spells, so, gonna re-make the test and EDIT the upper post

Offler
10-23-2009, 10:30 AM
Is there a way to create such windows application which will accept values for variable sized deck (60 or more for standard, exactly 100 for EDH, 100 or more for highlander), and variable sized hand for standard or Highlander mulligans, and also for variable amount of lands - also for different colors, colorless lands, basic or nonbasic...

Gui
10-23-2009, 11:15 AM
Is there a way to create such windows application which will accept values for variable sized deck (60 or more for standard, exactly 100 for EDH, 100 or more for highlander), and variable sized hand for standard or Highlander mulligans, and also for variable amount of lands - also for different colors, colorless lands, basic or nonbasic...

Actually, since I'm simulating the cards, the deck, and also few other things like card type and cast cost, I just have to make the line I want to follow and count the information I want. I could, for example, make it mull to 6 everytime it get a 0-land hand and add into the statistics. The problem is that I'm hard coding it, there isn't a Human Interface... It takes loads of time to develop such, since it has to be a lot customizable...

The formula above (hyp geom dist) is quite great at excel for doing what I posted in the first... I did a table here which is better than the simulation actually... You can add the probabities so that you get better info.


Actually there's a much "easier" formula for excel as you're using the hypergeometric distribution, formula being:
=HYPGEOMDIST([amount of copies you want from the card];[cards drawn];[copies available in deck];[decksize])

Just Quoted For Truth

libingboy
10-23-2009, 11:21 AM
Is there a way to create such windows application which will accept values for variable sized deck (60 or more for standard, exactly 100 for EDH, 100 or more for highlander), and variable sized hand for standard or Highlander mulligans, and also for variable amount of lands - also for different colors, colorless lands, basic or nonbasic...

you can do it in excel.
the main thing you have to watch out for is when you have a card that can fall into 2 or more categories (say, tropical island counts as a blue and green mana source), then computing the probabilities become a bit more complicated. Let's say you have 5 islands, 4 trops, and a forest, then to determine the probability of 4 blue and 2 green sources, you'd have to compute:
P(3 islands + 1 forest and 1 trop) + P(2 islands and 2 trops). Notice the first possibility requires 5 slots and the second only 4.

It becomes easier if you consider islands 1 category, forests 1 category and tropicals a third category.

Another approach is simply to do Monte Carlo simulation (similar to what Gui_brazil did). you could create a lookup table that assigns a particular value to a card and then just randomly sample a lot of hands. You could check mtgsalvation, there's a couple of mtg-related programs. It's possible somebody already wrote it out and posted a download link.

Gui
10-23-2009, 11:49 AM
you can do it in excel.
the main thing you have to watch out for is when you have a card that can fall into 2 or more categories (say, tropical island counts as a blue and green mana source), then computing the probabilities become a bit more complicated. Let's say you have 5 islands, 4 trops, and a forest, then to determine the probability of 4 blue and 2 green sources, you'd have to compute:
P(3 islands + 1 forest and 1 trop) + P(2 islands and 2 trops). Notice the first possibility requires 5 slots and the second only 4.

It becomes easier if you consider islands 1 category, forests 1 category and tropicals a third category.

Another approach is simply to do Monte Carlo simulation (similar to what Gui_brazil did). you could create a lookup table that assigns a particular value to a card and then just randomly sample a lot of hands. You could check mtgsalvation, there's a couple of mtg-related programs. It's possible somebody already wrote it out and posted a download link.

Yet, you can multiply 2 probabilities if you want both, ot add, when it's one or another

For Tropical, Forests and Islands, the probability on getting a blue sorce is
the probability of getting a Tropical + the probability of getting an Island

And the probability of getting both a Topical and an Island is
the probability of getting a Tropical * the probability of getting an Island

Which covers almost every doubt we could possibly have...

TheBirdMan
10-23-2009, 01:11 PM
This is pretty cool, nice job.

Forbiddian
10-24-2009, 05:58 PM
Would be easier to calculate precisely by going through the list of every single draw possibility.

It's how poker probabilities are discovered.

Nate
10-24-2009, 07:41 PM
Would be easier to calculate precisely by going through the list of every single draw possibility.

It's how poker probabilities are discovered.

But poker only has 52 cards...

Forbiddian
10-24-2009, 10:13 PM
But poker only has 52 cards...

Whoa, my god, 52. What was I thinking? I'm so retarded, thinking that 52 was close to 60. Er wait, nevermind. It's exactly the same thing.


Just create a set from 1-m of different cards, assign them just value n.

Ask for input and ask for maybe values n, o, and p. Group 1-n as "n", n+1-o as "o" and o+1-p as "p"

Write I guess the simplest way (not most efficient), write 6+ for statements to roll through the entire deck, and then after the last one, count the cards.

Plus, with that, you don't have to open up the can of worms of getting the monte carlo system to behave properly.


Monte Carlo simulation could work better for analyzing, say, Brainstorm and Fetchland applications. You could write out a compact AI governing behavior under different circumstances like mana screws or something.

Like it looks at the hand, counts the cards of each color, decides to search basic or non-basic, takes that out of the deck, holds fetches when mana screwed. Also it plays Brainstorms and etc. I mean, it'd be pretty complicated, but if the situation is controlled at all, then monte carlo is going to be unnecessarily inaccurate and actually more time-consuming.

CrazyMYKL
10-25-2009, 12:54 AM
I wrote some python scripts to calculate land draw probabilities.
http://mtg.pastebin.com/f72f21441

Here's a version with a GUI:
http://mtg.pastebin.com/f6782b279

Gocho
10-25-2009, 05:23 AM
I wrote some python scripts to calculate land draw probabilities.
http://mtg.pastebin.com/f72f21441

Here's a version with a GUI:
http://mtg.pastebin.com/f6782b279

Cool script :D

Thanks!

Offler
10-27-2009, 09:22 AM
what tools do i need to come this script alive? :) I dont use Python.

Thanks

Gui
10-28-2009, 11:29 AM
This is the .xls I made, which calculates the same thing from the previous post, a lot faster. Change the deck size and hand size for the different results

http://www.filefront.com/14813129/Cards%20Check.xls

Hope filefront keeps it alive

;D