Paracel

Math, Hearthstone, and You

11 posts in this topic

Posted (edited)

Disclaimer : the following information is intended for people who only know how to count to 30a fellow average Hearthstone player, so there may be some wild simplicities and generalizations. If this offends you, oh Mighty Sage of Numbers, Wielder of Degrees and Master of Algebra, please accept my humble apologies.

Hi, it's me, Paracel, and today I want to share with my fellow Icy-Veins community some old goddog tricks that I've learned long time ago. 

You see, science is a cool thing, and even though no theory really survives a practice, it can shed some light on some of the universe's most treasured secrets, like these : 

  • How much 1-drops do I need to play to get a consistent curve?
  • How lucky was your opponent to draw that second removal spell?
  • When do I draw my other Taunt
  • How big is my C'Thun going to be on average?
  • Is there a way to draw my Desert Camels before my Injured Kvaldirs? 
  • And of course, the most mysterious one : Why do Warriors always have a Fiery War Axe in their opening hands?

Alright, you got me on Warriors. What the hell are you talking about, dude? 

There is a special mathematical formula called Hypergeometric Probability that was pretty much tailor-made for card game like Poker or Hearthstone. It lives in your Excel charts, but my iPad can't do that, so I use online calculators like this. (Strongly advise you to use one as well, because counting it manually is going to take sli-ightly more than one turn.)

A hypergeometric experiment looks like this : 

  • There is a population of N items, where k items can be identified as successes, and N-k as failures. 
  • You select a sample size of n items without replacement from that population of N. A number of successes in that sample is x

Obviously, our population N is our deck, k is what we want to draw, and n is how much cards do we draw.

A hypergeometric formula looks like this :

[ kCx ] [ N-kCn-x ] / [ NCn ] 

but hardly it makes any sense to you. Trust a calculator.

But isn't a normal probability enough? 

Nope, it's slightly more complex than it looks like. You see, when you draw cards from your deck, they don't come back like they do if we'd be doing a normal (a binominal) experiment. Flipping a coin does not affect the outcome of a next flip, while drawing a card does. 

Let's say you have an urn with 10 marbles - 5 red and 5 green. You take 2 marbles out of the urn, then count the number of green marbles you took out. Chances are your first marble is green is 5\10, but a second one is chosen out of 9 marbles, thus being 5\9 if your first marble is red and 4\9 if your first marble is green. 

Ok, I think I get it. Let's get back to Fiery War Axes.

Opening hands don't make a good example, but this question is superhot, so I'll do it.

Spoiler

 

Your population size - a deck - is 30 cards. 
Number of successes - Fiery War Axes - is 2.
You are going second. 
Your starting hand is 3 cards. You also get a mulligan and draw 1 card at the beginning of your turn. 
That makes a sample size of 3 (I'll talk about mulligan later).

If you run these numbers in a calculator, it will say that chances are you draw exactly one Fiery War Axe in your starting 3 are 18.6%, and cumulative probability (>1) is 19.3%. We're looking for cumulative probability, because at least one is what we want.

But that's all before mulligan

The way mulligan in Hearthstone works is that you put a card back in your deck, than draw a new one. It may very well be the same card, so it makes for a full second run in case you missed the first time. 

19.3 % you got it = 80.7% you didn't and thus mulligan. That means our chances to get our Axes here are 80.7%*19.3% = 15.5% - we need to hit both probabilities, that's why we multiply instead of adding.

Also the card at the beginning of your turn. It is drawn out of 27 cards, thus has a 7.4% chance to be Fiery War Axe. 

So a total would look like this:

19.3% + 15.5% + 7.4%  = 42.2%

Going second it's going to be a starting hand of 4, a card at the beginning of turn is drawn out of 26 and thus a total is 

25% + 75%*25% + 12% = 55.7%.

Problem = solved. Mystery = revealed. Games = won (or lost).

 

Whew, what a ride. I hope you folks got what I'm talking about. There is more advanced explainations down that link. Check them out if that floats your boat.

Seriously, go and play with that calculator, run some math. Do your homework and you'll win games before they even start. Knowledge is power and going from "likely to have" or "he probably doesn't" straight to percentiles can guide you through decision trees pretty quickly. 

Have fun, play tight, and may the Force be with you.

Edited by Paracel
Lost a pun while editing
6 people like this

Share this post


Link to post
Share on other sites

Oh boy, probability theory all over again, thought it was over after the first year of university :D.

First off, i would like to point out that this artice imo applies to above average hearthstone players, not just average. The average player won't sit down and calculate the odds of him getting the card he wants, or the odds of his opponent having the right answer. (Most of the times he/she would say he got "fucked by the topdeck" :D ).

Having said that, you did a really good job explaining how the calculation of the probability is done, in simple words. Also i really like the structure of the post, having a lot of information but on the same time not being tiring to the reader.

Well done sir, you get a like from me. I hope this post helps a lot of people in game, and also give them a little hint to get into the beautiful world of probability theory.

Share this post


Link to post
Share on other sites

great post mate ..but still the thing that affects one statistical equation from another is the duplicates you have in your deck disregarding the curve and how the game stores the cards in your deck based on mana cost ..it would be cool if we can assemble a more basic mathematical approach to a specific archetype giving a rough probable outcome to drawing x card rather than making a basic reference to x deck ..i know this might take alot of time to invest in making a spread sheet with probabilities of outcomes from each archetype but am intrigued about the mathematical approach that might aid players in understanding how and when to go for x card in there mulligans rather than the standard openings based on the opponent they might face ..nevertheless quality post my friend :)   

Share this post


Link to post
Share on other sites

Even for being a peasant that just forgot Brawl when playing a Control Warrior (in my defense I had no way to play around it at least) I say having the general formula is good enough, I feel this is more useful for deckbuilding as I believe that after tons of games the true experts just "feel" the opponent's hand and the average rarely will take the effort to do all this stuff.

So, to check if I understood I'll try to make an example:

I run Aggro Paladin and I want to know how many chances I have of getting an Argent Squire or a Selfless Hero in my starting hand while going second, out of 30 cards i'm looking of 1 in 4 so the Cumulative Probability: P(X > 1) is 45,4% before mulligan, and the Cumulative Probability: P(X < 1) is 54,6%, so mulliganing all my hand away makes it 54,6%*45,4% = 24,7%. If I haven't gotten any until now I have a 15,3% chance of drawing at the start of the turn

So the chance of having one between Argent Squire and Selfless Hero in my starting hand by going second is 45,4%+24,7%+15,3%=85.4% barring any mistake in the calculation.

Share this post


Link to post
Share on other sites

Posted (edited)

Fun stuff!
I have a computer science and math background, so I had to dig into it a little deeper. The basics of the math are very sound, but some minor errors. 


Take the example of a warrior going for 1 of the 2 Fiery War Axes in his deck.   Assuming he goes first, he has a 19.3% chance of getting at least one in the opening draw.  If he doesn't, he can mulligan his hand and have the exact same chance of getting one in the next three cards, because the three he had initially are put back into the deck and may be drawn again.  Then theres the 7.4% chance of getting one on the first draw of round one, assuming he didn't get one already.


So you might think you can just add 19.3% + 19.3% + 7.4% = 46.02%.  


But, you cant just add probabilities together like that. If you have a 50% chance something could happen the first draw, and a 50% chance it could happen the second draw, its not 100% certain it will happen between the two of them. Its actually only 75%  Basically, the probability that at least one of the draws will have the card you want is equal to 1 minus the probability that none of the draws will have a card you want.


X = 1 - ((1 - 0.5) * (1 - 0.5)) = 0.75


So in the Fiery War Axe case, it comes out to 39.7%


X = 1 - {(1-.193)*(1-.193)*(1-.074)} = .397


You can also streamline things a bit by combining the card drawn before round one into the mulligan - you're going to draw it no matter what anyway.  So if you go first, you get one draw of 3 cards, then a mulligan of 3 + 1.  Going second gets you one draw with 4 cards, and one with 5.  The numbers work out the same.


X = 1 - {(1-.193)*(1-.253)} = .397

 

I worked out a spreadsheet to show the chances of getting a card you want on the opening hand. The left column shows the number of target cards in your deck, the far right shows the chance of getting at least one of them in your starting hand. in these charts, i included the card drawn for round one into the mulligan percentage. So if you're playing the aggro Paladin deck with two Argent Squire and two Selfless Hero, your chances of getting at least one is 65.06% if you go first, and 74.82% if you go second. 

 

Card draw probabilities - going first
Target Cards Opening Mulligan Total %
1 10% 13.33% 22.00%
2 19.31% 25.28% 39.71%
3 27.95% 35.96% 53.86%
4 35.96% 45.44% 65.06%
5 43.35% 53.84% 73.85%
6 50.15% 61.22% 80.67%

 

 

Card draw probabilities - going second
Target Cards Opening Mulligan Total %
1 13.33% 16.66% 27.77%
2 25.28% 31.03% 48.47%
3 35.96% 43.34% 63.71%
4 45.44% 53.84% 74.82%
5 53.84% 62.71% 82.79%
6 61.22% 70.17% 88.73%

 

Edited by Allegro
5 people like this

Share this post


Link to post
Share on other sites

Thanks for correcting me! At least one person here knows exactly what he is doing ;)

Also that spreadsheet is pure gas! Makes it really digestible and covers up pretty much any scenario. Thumbs up!

Share this post


Link to post
Share on other sites

I am glad there are people who like to do prob and stats.  Keeps me lazy.

1 person likes this

Share this post


Link to post
Share on other sites

I dont know if I know EXACTLY what I'm doing, I had to break out my old stats manual to remember most of this! 

If theres interest, I'm working on some additional charts to show probabilities of getting at least two target cards in your opening draw, and one for getting at least one of two different cards - such as "what are the odds that the warrior draws Fiery War Axe and Upgrade?"  Or if there are any other requests, I'm willing to give them a shot.

1 person likes this

Share this post


Link to post
Share on other sites

The combination charts seems interesting, this stuff is magnificent for deckbuilding, if only I actually had cards I could try building something...

Share this post


Link to post
Share on other sites
On 7/7/2016 at 8:50 AM, Allegro said:

Take the example of a warrior going for 1 of the 2 Fiery War Axes in his deck.   Assuming he goes first, he has a 19.3% chance of getting at least one in the opening draw.  If he doesn't, he can mulligan his hand and have the exact same chance of getting one in the next three cards, because the three he had initially are put back into the deck and may be drawn again.  Then theres the 7.4% chance of getting one on the first draw of round one, assuming he didn't get one already.

Just a minor thing, but I think the devs clarified once on twitter that during mulligan, the cards that you throw back into the deck won't be drawn again (they could very well be top-decked turn1 or you could get the second copy of any card, but not the copies that you mulligan away).

1 person likes this

Share this post


Link to post
Share on other sites
On 7/9/2016 at 8:28 AM, drumsmani said:

Just a minor thing, but I think the devs clarified once on twitter that during mulligan, the cards that you throw back into the deck won't be drawn again (they could very well be top-decked turn1 or you could get the second copy of any card, but not the copies that you mulligan away).

 

Back to the drawing board....

That will actually make your chances a bit higher to draw the cards you want.  I'll get the spreadsheets updated.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.