Thursday, 19 September 2013

Malifaux: Odds of drawing a certain card

I've been playing Magic a bit recently and one of the things that I've been looking through is the odds of the drawing a certain card from your deck.  Magic is bit different from Malifaux in that you don't re-shuffle your hand every turn, but the general principal is the same.

On the surface it seems quite simple.  I've got 12 face cards in my deck (11-13 of each suit), plus the red joker meaning I have a 13/54 chance of getting one on a single card draw.  That's true but, once you draw a single card the odds tilt slightly in one direction or another so it turn's out that working out these odds was more complicated than I thought.

Turns out this is something called a hypogeometric distribution and involves factorials and other stuff I distantly remember from A-level maths.

For those lazy people like me, you can get Excel (other spreadsheet software is available) to work out for you using this formula.  I think this is right, feel free to correct me if not and note I'm using Excel 2010 here.  Earlier versions just had HYPOGEOMDIST function which is more or less the same:

=HYPOGEOM.DIST(number_cards_we_want, hand size, successes in population, total population, FALSE)

The FALSE bit here is to calculate the probability density function which gives us the result of exactly 1 severe.  Changing that to TRUE would give us up the number of severe cards which could also include 0.

For example, the chance of drawing exactly 1 severe in an hand of 6 cards from a deck of 54 is 0.377 or 37% which we can find using the function in Excel =HYPOGEOM.DIST(1,6,13,54,FALSE).  Never feels like that though does it?

This number is going to be skewed in turns after the first given you're drawing less cards usually if you have some in your hand, plus the population size is then going to be slightly less.  In an extreme case you might have 5 severe cards already in your hand and only be drawing one in the draw phase in which case your odds of of drawing a severe are going to go to about 16% (=HYPOGEOMIST(1,1,8,49,FALSE).

Here's some odds you might be interested in:

Chance of drawing no severes on the first turn (=HYPOGEOM.DIST(0,6,13,54,FALSE)):  17%
Chance of drawing a joker first turn (=HYPOGEOM.DIST(1,6,2,54,FALSE)):  20%
Chance of drawing 1 of a specific rank card first turn (=HYPOGEOM.DIST(1,6,4,54,FALSE)):  32%
Chance of drawing 1 card of a specific suit first turn  (=HYPOGEOM.DIST(1,6,13,54,FALSE)):  37%
Chance of drawing 1 card of a specific suit of 8 of higher first turn (=HYPOGEOM.DIST(1,6,6,54,FALSE)):  39%

Some of these numbers seem a bit counter intuitive but the stats don't lie (or I'm doing it wrong in which case they might well be lying).

Here's our likelihood of drawing those face cards in our opening turn:

0 face cards:  17%
1 face card: 37%
2 face cards:  31%
3 face cards:  12%
4 face cards:  2%
5 face cards:  0.2%
6 face cards:  0.006%

Interesting.  You can see the most likely draw in your opening hand it to get 1 face card.

Let look then at a couple of card draw mechanics I'm been using recently:  Primordial Magic's Rush of Magic Ability and spending soulstones to draw 2 more cards.

Rush of Magic
This ability lets us draw and additional card and then discard down to our maximum hand size.  Let's see what difference this makes to the table above:

0 face cards:  13%
1 face card:  33%
2 face cards:  33%
3 face cards:  16%
4 face cards:  4%
5 face cards:  0.5%
6 face cards:  0.003%

This has improved our odds by a few percentage points.

Soulstones
So what happens when we use a SS to draw two more cards (so our sample size is 8):

0 face cards:  9%
1 face card:  28%
2 face cards:  33%
3 face cards:  20%
4 face cards:  6%
5 face cards:  1%
6 face cards:  0.001%

This was a bit unexpected.  We actually less likely to get just 1 face card than we were before but more likely to get multiples.

Rush of Magic and Soulstones
Let's combine them for a sample size of 9:

0 face cards:  6%
1 face card:  24%
2 face cards:  33%
3 face cards:  24%
4 face cards:  10%
5 face cards:  2%
6 face cards:  0.003%

So with the two combined we're 12% more likely to get exactly 3 face cards than with neither of them.

If you can't bothered with Excel, then stattrek.com has a handy online calculator for you.  One thing is clear:  card draw abilities are powerful in M2E.




3 comments:

Adam Rogers said...

Good post. This side of the game doesn't get quite as much attention, possibly because of the difficulty of the stats that you discovered.

Tigerstyle said...

Thanks Adam, it took me a long time to work this lot out. The stattrek link I've put at the end of the post is really easy though and means you can do these calculations very quickly. It also gives you the cumulative probability which is the chances of getting up to the number of cards you want which includes 0.

mike3838 said...

Had a bit of a play with the Hypergeometric function for the first time just now.

I agree the the best measure for these kind of things can often be "what are my chances of getting *at least* X successes", requiring you sum all outcomes with X or higher.

I did a quick calculation off the back of your numbers (base vs. using a Soulstone), and it looks like using a Soulstone to draw cards adds (on average) 0.52 severe (incl RJ) cards into your control hand. This should naturally come at the expense of loosing 0.52 weak/moderate cards from your control hand.

I'm going to see if I can split that 0.52 lower card loss out into weak and moderate, but I think I'll need to consider some different cases (eg. starting hand before SS use containing different numbers of weak cards)