NO, I’AM in charge now! Defeating Patches




Patches the Pirate, one card many people get upset with in the current meta. It is a powerful card which, if played early, have 58% win rate. However, it is also the easiest card to get into play since playing a single low cost pirate would do it. Warriors, most of which run Patches the Pirate, is the most played class since the patch and this card is a big reason of why. We will therefore when laddering meet and have to defeat many Patches the Pirates. But how do we counter one of the most powerful and played cards in the current meta?

In order to do this we will compute the win rate of cards played one turn before/after turn one or two Patches the Pirate plays. This way we can, for every class, find the most powerful counters to this dreaded pirate.

Priest, Mage and Warlock

In the graph below we see the 3 most powerful counters to Patches the Pirate for the Priest, Mage and Warlock (in that order). The blue bars is the card’s win rate in general and the red bars is the card’s win rate as a counter. Note if the opponent plays Patches the Pirate you would only have 42% chance of winning so any red bar above 42% is an improvement your current situation. The shaded areas is the uncertainty (95% confidence intervals).

Most of the counters are minions with high health, which prevents Patches the Pirate from trading favorably. Mortal Coil works well but the other one damage spell, Fireblast, does not improve the situation of the Mage considerably. Both the Warlock and Priest can manage Patches the Pirate better than the Mage.

Shaman, Druid and Rogue

Shaman, Druid and Rogue counters to Patches the Pirate.

The Shaman, Druid and Rogue have good counters against Patches the Pirate. The Shaman’s Maelstrom portal even performs better when played against Patches the Pirate than in general. The best way for the Rogue to counter Patches the Pirate is to run pirates as well. Playing Patches the Pirate against himself does, as expected, net a 50% win rate.

Warrior, Paladin and Hunter

In this graph we show the 3 best counters for the Warrior and two best counters for the Paladin and Hunter against Patches the Pirate. There was not enough data to show more counter-cards for the Paladin and Hunter because of their low play rate.

Neither the Paladin or Hunter have any good responses to Patches the Pirate and could be one explanation of why they are struggling so much. We can only hope they will have a better response once Un’Goro comes out! Warriors on the other hand have several great counters, and out of the top three, neither is Patches the Pirate himself. The Warrior is also the class best equipped for dealing with Patches the Pirate. This indicates a problem since if the best counter to a deck is the deck itself, the meta becomes less dynamic and interesting.

Final Words

Journey to Un’Goro will be out soon and with it plenty of more tools to counter Patches the Pirate. Hopefully Hunters and Paladins will see a revival in the expansion, either because Patches the Pirate becomes a less popular play or because they get new exciting cards to deal with early threats. Until then, have these graphs in mind when playing against Patches the Pirate and show him who is really in charge!

About the Data

Data gathered from HearthScry and contains 24162 ranked games from 1 December 2016 to 24 March 2017. Games which included Small-Time Buccaneer and Spirit Claws plays before the nerf patch was removed.





The Marsh Queen: An interactive tool for deckbuilding




We made an interactive tool for exploring how easy it will be to complete the new Hunter quest, The Marsh Queen, for different Hunter decks. Choose how many one-drops your deck has and see how the quest completion probabilities changes! The computation of the probabilities is stochastic (random) and is computed in the background, which is why the graph will move around a little after the input parameters have been changed.

Show probability quest is completed at a certain turn
Show probaility quest has been completed at / before a given turn

Input Parameters

/ 29 one-drops

/ 2 Fire Flies

/ 2 Small Raptors

/ 2 Tol’vir Wardens

extra card draw by turn

Input Explanation

Select how many 1-mana drop minions your deck is going to include. Max is 29 cards since one slot is needed for the quest. We may also select how many of our 1-drops which are Fire Flies and Small Raptors, and how many of our non 1-drop cards that are Tol’vir Wardens.

We may change the expected number of extra cards drawn at a given turn. The simulation does not take into consideration how these cards are being generated, instead it is up to us to guess how much card draw our deck will have.

Simulation

It is possible to use probabilistic methods to compute the probability of having drawn 7 one-drops at a certain turn. However, the impact of cards with secondary effects, such as Tol’vir Warden, makes this process a lot more complicated. Instead, we run a simple simulation many (50000) times. The simulation is stochastic and will have different outcomes every time and from all these generated samples we can compute the probabilities. By using this method we can easily include more complicated card effects and see how they affect the deck!

The simulation simulates mulligan (by discarding non 1-drops), card draw and the play / effects of the three specific minions. In the simulation it is assumed that The Marsh Queen is played on turn one. Both Small Raptors and Tol’vir Wardens are assumed to be played as soon as they are drawn and mana becomes available (Turn 2 for Small Raptor and turn 5 for Tol’vir Warden). At the moment it is assumed the quest takes one of your starting hand slots, which gives 2-3 cards to mulligan depending on who goes first. The simulation does not take The Coin into consideration.

The Hearthstone Ecosystem: Before and After





We know some classes in Hearthstone are expected to win in certain matchups. We can see the analogue of these biased matchups as predator-prey dynamics in nature, but instead of the fox hunting the rabbit, the Warrior is hunting the Paladin. In nature, if there are too many predators, the predation pressure on prey will be too high, the prey will have a hard time to populate and the predators will in turn run out of food. In Hearthstone, we see the same dynamics, low performing classes will be abandoned for high performing classes. When the player base migrate from a prey class to predator class, the performance of the new class will decrease as they play against their prey less and the amount of mirror matches increases, pulling down the win rate of the predator class closer to 50%. Classes that counter the popular top-tier class will then become more viable to play as their specific prey population increases, in turn preventing the growth of the original predator. As the counter class increases in population there might be a counter-counter class, etc. When we consider all these predator-prey relationships simultaneously, we see the entire ecosystem of Hearthstone.

An Ecosystem in Change

We can look at how the ecosystem changes over time by comparing it before and after the late February 2017 nerf patch. To do this we will draw two networks of the predator-prey relationships based on data from the two time periods. Each node in the networks represent one class and their size show how popular the class is. Between nodes with a predator-prey relationship (favored class has win rate > 55%) we draw an arrow, pointing from the predator class to the prey class. The color of the nodes and arrows show the overall and matchup specific win rates, where red is low, yellow average and green high win rate. The first and second network show the ecosystem during one month before and (approximately) one month after the patch respectively.


Poor Hunters and Paladins! Two classes preyed upon by a majority of the other classes, both before and after the patch, and their population is subsequently repressed. Shaman and Warrior are both apex predators during both timeframes as neither of those two have any predators and are the two most played classes in the current meta. Druid had a hard time before the patch, but after they lost the predation pressure from the two apex predators the Druid player base is allowed to grow. The Hunter now preys on the Druid but because of the low amount of Hunter players, this hardly matters. Priest and Mage are now more viable picks as well due to the decreased predation pressure.

The patch removed several of the predator-prey relationships, improving play and fixing the situation for several of the classes. However, Warrior is still as powerful as before and Hunter and Paladin haven’t seen much improvement, so the patch could have done more to balance things further.

Improvements

Different classes can be played very differently. Optimally, we would compare the archetypes with each other rather than the classes. However, the data set used is too small to do this. Building an archetype based ecosystem is something we instead will do in the future!

About the Data

Data gathered from HearthScry and contains 11379 ranked games for February 2017 (pre nerf) and 8753 ranked games for March 2017 (post nerf).



The Most Predicable Class in Hearthstone




We built a model for predicting Hearthstone games in our previous article and by using this model, we can do all sorts of interesting things. As an example of this, we will this article look at which class is the most predictable (from the perspective of our model) which will give us some insight into which classes we need to be on our toes when playing against. We can show this by dividing the test set games into different classes, where a game count to the statistics of a class if at least one of the players is of that class.

The easiest classes to predict is the Paladin and the Rogue with 69% correct predictions followed by Warrior, Priest and Warlock with 68% correct predictions. Mage and Hunter are the two classes hardest to predict, with 65% correct predictions. Shaman, the class with the most random effects, is in the middle with 67% correct predictions.

Note, the amount of games played for the different classes varies greatly. One might think the more games played with a class, the more data we have and the easier it will be to predict the outcome for that class. This is, however, not strictly true. There is some weak evidence of a relationship between number of games played and easiness of predicting between the classes (not counting Paladin who is a clear outlier) but, even when compensating for it, not strong enough to change our results.

About the Data

Data gathered from HearthScry and contains 32565 ranked games between 1 December to 28 February 2017 (pre nerf).

Predicting the winner of a Hearthstone game




From previous posts we visualized the win rate for The Coin played with other cards. The question we might ask ourselves is, can these visualizations actually help us be better at the game, or is it just bullshit statistics? To prove it is not bullshit, we will build a Bayesian inference model from our win rate data to predict who the winner is! To do this we need to split our data into a training- (80% of all games) and test set (20% of all games). We will use the training data to compute the win rates. At the end, we will use the computed win rates to predict the winner of the games from the test set and see if we were correct or not. That is, we will predict game outcomes which haven’t been used to build the model and is, from the perspective of the model, completely unknown.

Comparing Different Models

We will compare three different models of varying complexity. The first is simply basing the predictions on win rates of matchups, e.g. Rogue versus Paladin. The second is by measuring the win rate of all cards played in the match, and the player who played the most powerful cards is predicted to win. The third model build upon the second but also take the temporal aspect of card play into account, e.i. what turn a card was played. In the graph below we measure the error rate, the percentage of our guesses which were wrong, of these models. The blue bars is the error for the training set while the red bars is the error for the test set. Note, if a monkey would guess who the winner of a game is it would be correct 50% of the times. If our model doesn’t do better than a that, it is useless.

Predicting the winner using matchup data does not do better than the monkey so we can discard that model. If we instead base the predictions of which cards are played, we get significantly better predictions (66% correct). This is actually really cool because the model have no idea of the rules of the game nor what the cards actually do! This also tells us that having a good deck and good / lucky card draw is very important.

When we include the turn play information into the model, the training error is reduced a lot while the test error is reduced by a small bit (67% correct). This is because the model get more overtrained as the data becomes more sparse. We could probably improve this if we had more data. Another solution would be to compensate for the overtraining, but is out of scope for this article. For the rest of the article, we will use the “Card turn play” model.

Note the training error never reaches 0%. This is because there is much more to Hearthstone than what our model is based on and why it is important to compare the relative error rates of the different models rather than their absolute values.

Prediction Versus Game Length

Let’s look at how easy it is to predict games depending on how long they are. The sizes of the circles show the number of games that ended that turn.

First thing we note is most games ends at turns 6 to 8. Looking closer, the game length probability actually follow an extreme value distribution. In real life, this probability distribution is used to measure extreme events in financial risk or epidemic health. I guess the end of a Hearthstone game also could be considered an “extreme event”.

The easiest games to predict are those that end at turn 4. After that, the predicting difficulty increases as well as the difference between the training- and test set errors. This indicates the model gets more overtrained for longer games, which is to be expected. Since most games end early, high cost cards will see less play, we will have less information about them and hence, the model will get more overtrained. Before turn 5 the training- and test error behave similarly which mean we have enough data in that region to prevent overtraining and the error we get is due to limitations in our model.

Early Prediction

We can also use this model to predict the outcome of a game several turns before it actually ends. In the graph below you can see the error rate when we try to predict up to four turns before the game ends. To make the comparison fair, we only look at games which are four turns or longer.

As suspected, the error increases the farther we look back but the graph also show us that if you are in the lead, you are also expected to win. The shape of this curve could actually be considered as how swingy Hearthstone is. The quicker this curve reaches 50% error rate the higher probability it is for the game to swing around to the underdog’s favor. Not terribly interesting by itself but we could, in the future, compare how this graph looks like for different classes and determine which class is the best at recovering a losing game!

Why not use other machine learning algorithms instead?

To predict the winner we could have used machine learning algorithms instead and, probably, get better predictions. However, this article is not about getting the best predictions possible but show that the simple win rate model based on known games actually can be used to predict the winner of a new unknown game. Additionally, this model is completely transparent, we know exactly how it works compared to, let’s say, a neural network. This knowledge will let us do all sort of interesting things in the future!

Final words

Our model could indeed predict the winner of a Hearhstone game. This is good news since it mean we can look at the win rate data and actually learn about the game. However, our model does have problems with overfitting. If we would also include card interactions into the model the data would be even more sparse and overfitting would become an even bigger problem. To include more specific things like that we could combine several models and use more simple models as fallback for cases we do not have much prior knowledge of. In the future we could use this, or a more advanced model, to automatically analyze our games and have the computer teach us what our most common mistakes are.

About the Data

Data gathered from HearthScry and contains 32565 ranked games between 1 December to 28 February 2017 (pre nerf).