Card Draw Calculator

I’ve been playing Valve’s new card game, Artifact. It’s a lot of fun and I’ve been having a great time brewing up new decks to throw against my friends. One of the things I noticed online though, is that for many people it might be their first card game.

I’m a dedicated card game player so I was able to bring over a lot of knowledge and skills from Magic: The Gathering and Hearthstone to Artifact. Part of that is the general practice of including as few cards as possible in your deck to ensure you’ll consistently be drawing cards that you need. When reviewing decks of newer players online, I noticed that they would often break this unspoken rule to play too many situational cards. After explaining the logic a couple times I thought it would be fun to build a little calculator to show how including additional cards impact your draws.

Little did I know that I would end up talking to two mathematicians and end up writing my own combination functions. Turns out the best way to calculate sampling without replacing (like drawing cards from a deck) is something called hypergeometric distribution. We’re using inverse hypergeometric distribution to check the liklihood of not drawing a single copy of a card given the deck size and number of copies of the card in the deck. When we calculate that probability, we can subtract it from 1 to determine the chance of having drawn more than 0 copies. At least that’s how people who know math explained it to me.