Tag Archives: app

Detailed card statistics in the deck simulator

In addition to the 50-some cards I added to version 1.3 of Deck Simulator for Hearthstone, I also included a new feature where detailed statistics are tracked for each card and displayed in the “Game log” window at the end of the simulation, organized by deck.

I’ll give a few examples to explain what these statistics mean and how to interpret them:

  •  (Fireball): draw = 72%, play = 54%, att =  0%, died =  0%, dam = 3.268232

I think most of you already know “Fireball”, but just in case it’s a neutral spell that deals 6 damage to any minion or player for a cost of 4.

“draw” here represents the percentage of games in which a Fireball card was drawn. This includes even if the card is redrawn initially, or if the card is drawn and not used. Generally speaking, this number is a function of the number of the card in the deck (either 1 or 2) and how long the average game lasts. It doesn’t mean too much on its own, but is useful when combined with the other stats.

“play” here represents the percentage of games in which Fireball is played (cast). It must be less than or equal to the “draw” figure, since you can’t typically play a card without drawing it (except for a few special cases). If this figure is much lower than “draw”, then that usually means there wasn’t frequently enough mana to play the card or a good opportunity to play it.

“att”, “died” represent the number of times this card attacked or died in a game. It only applies for minions and is therefore 0% for spells like Fireball. “att” can be higher than “play” since a minion can attack several times a game if it stays alive or has windfury.

“dam” represents the total amount of damage this card dealt on average in all simulated games in the current run. For cards like spells you can sometimes figure this out from the other statistics (i.e. for this card we see that 6 x 0.54 = ~3.2), but for minions this number is a bit tricker since it includes damage both from battlecries, deathrattles, as well as attacking.

  • (Ragnaros the Firelord): draw = 71%, play = 52%, att =  0%, died = 21%, dam = 7.480020

Ragnaros, one of my most favorite cards, is a unique case since it is a minion but can’t attack, and so “att” statistic is 0%. However, since it does deal 8 damage at the end of your turn, the “dam” statistic is non-zero (around 7.5).

If you think about these statistics can you can draw some conclusions. For example, Ragnaros deals 8 at the end of each turn, yet it dealt around 7.5 on average. Putting this together with the fact that it was only played around half of games (52%), this implies that it dealt damage roughly twice per game, and was alive about two turns.

However, since it only died less than half of the time it was played (21% vs 52%), why didn’t it typically live more than two turns? Easy – this means that the game tended to end around two or three turns after Ragnaros was played, and I’m betting it was often in favor of the player who managed to play this great card.

  • (Elven Archer): draw = 64%, play = 63%, att = 38%, died = 58%, dam = 1.183317

In the case of Ragnaros, the card was played roughly 73% of the time (= 52%/71%) it was drawn, which is actually pretty high considering it costs 8. But if you look at Elven Archer (1 1/1 for cost of 1 with 1 damage during battlecry), it was played roughly 98% (= 63%/64%) of the time. This makes sense because it’s cost is so low.

With only a one in toughness, it died most of the time (58% / 64% = 90%) and only managed to deal 1.18 damage per game. This translates to 1.18 / 63% = 1.873 damage when it was played, and 1.0 of that is from the battlecry. However you shouldn’t jump to conclusions that this card was useless since it did so little damage-wise, because that would discount the preventative effect it might be having to kill enemy attackers or other minions that are part of dangerous combos.

You may be wondering why the draw rate is not higher than Ragnaros, the reason is because I have only one of this card in the deck (same as Ragnaros).


These stats take some time to understand but I’m hoping many people will find them useful or at least interesting. For starters you can use the damage stat to see which cards are pulling their own weight and which are slacking, and tweak your deck to improve your overall win rate. And if you get creative, the sky is the limit!


Card Importance Testing in the simulator

This is the third installment in a series of three posts about the new features present in 1.2 which has recently become available on the app store.

The first two discussed the per-participant statistics and HELO (Hearthstone ELO), and this final post will focus on Card Importance Testing which is another new feature.

One of my goals in writing Deck Simulator for Hearthstone was to create a tool which would allow adjustment of existing decks to improve their overall effectiveness, or simply put, win rate. While it is possible to create a bunch of variations of a deck with different card variations and test them, doing so can be time consuming and tedious. Because of this, I decided to try and add a feature which would help guide how to modify a deck.

Because of the large number of cards available (a few hundred including neutral cards), rather than focusing on what card(s) to add, I decided to focus on determining which cards to remove. After all, since all legal decks in Hearthstone require 30 cards, if you want to add a card you must first remove one. (Note: Below you will see a reference to using a  28- or 29-card deck, which is a special feature only present in the simulator)

Imagine you knew which of your cards really were doing the lions share (helping win games) and which were just going along for the ride. This would be one major step to finding how to improve your deck, since you could replace those cards with other cards that might have a greater positive effect on the deck as a whole.

I’ve added this type of Card Importance testing via a single button available on the “Configure Simulation” screen, aptly titled “Test Card Importance”. To use this, simply choose a AI Player and Deck, and click the button. This will add several participants (AI + deck combinations) to the list of participants:

  • Two participants where the selected deck is added, unchanged.
  • One participant with a modified deck where all cards of a certain name are removed from the deck. This can be one or two cards depending on how many were in the deck, and these holes will not be filled with other cards. For example if your deck contains two instance of “Arcane Missles”, there will be one participant with both of these cards removed (down to a 28 card deck), and whose name will be of the form :(removed XXX) > original deck name (due to space considerations the player being used will not be shown in the name as it usually is).

The reason for the first unchanged deck is so you can play each deck missing one of the card names against the unchanged deck, and compare to see whether the removal of thiscard decreased or increased the overall win rate. Alternatively, if you want to compare against another deck you can add that deck first before clicking the “Test Card Importance” button, and all modified decks will play against that instead.

(The reason for the second unchanged deck is to help guide the right number of games per match. More on that below.)

To illustrate a real example, I did the following:

  • Selected “Evl. AI (strong)” as the AI Player (or just leave it as this is the default)
  • Selected the deck “Evolved Paladin 215” and clicked “Add to simulation”
  • Selected the deck “J’s Mage Deck” and clicked “Test Card Importance” (blue button on right middle)
  • Made sure Simulation Type was set to “All play first”
  • Changed the slider “Matches per pairing” to 1001 (maximum value)
  • Clicked “Start simulation”

Here is an excerpt from the results I got:

  • [1921] Evl AI (strong) < Evolved Paladin 215 < Win 80.9% of 23023>
  • [1121] (removed ‘Arcane Explosion’) > J’s Mage Deck <Win 24.2% of 1001>
  •  …
  • [1062] (Unchanged) > J’s Mage Deck <Win 19.4% of 1001>
  • [1018] (Unchanged) > J’s Mage Deck <Win 19.3% of 1001>
  •  …
  • [883] (removed ‘Ragnaros the Firelord’) > J’s Mage Deck <Win 15.4% of 1001>

The most important thing to know about reading these results is that they are backward from what you might usually expect. For example the fact Ragnaros is on the bottom of the results (with a 15.4% win rate versus an 19.3-4% one for the unchanged decks) actually means Ragnaros is one of the main contributors to this deck since without him it’s performance falls significantly. Conversely, the deck actually performed *better* with two Arcane explosions removed from the deck.

So, from this little experiment we learned some information about one card that we probably wouldn’t want to remove from the deck (Ragnaros) and one that is a good candidate for swapping out for something else (Arcane Explosion).

The reason for the two unchanged decks is to determine how stable the simulation results are based on the number of matches per pairing. Ideally, since these decks are the same, you should get nearly the same win rates, and in my simulation with 1001 matches per pairing you see only a 0.1% difference, which means the results are generally valid. However if you were to run a solution with only 100 matches per pairing, you might get a variation of 5-6% between these two win rates, which tells you there isn’t enough data to properly capture the decks’ strengths. If you have the time and can wait for the simulation to finish, more matches is always better.

I choose “Evl. AI (strong)” here instead of the stronger “Evl. Planner (med)” because it’s significantly faster, but once I narrowed down to a few candidate cards to remove I suggest running another test with the planner type to further validate things. Also because in “All play first” games the statistics tend to be a bit less stable,  you may want to run one or more simulations with “All play all” to see how your modified deck(s) do against a few different types of decks. For these follow up runs, you can simply delete the participants  you don’t care about and re-run a different simulation as needed.

Remember, each time you run one of these simulations you should expect to get slightly different results just because the random number generator will be a bit different. But if you have enough matches per pairing, you shouldn’t see the win rates change more than few percent points between runs. You’ll find a clump of cards which are consistently on the top (the weak ones) and another clump that are consistently near or at the bottom (the strong ones).

Deck Simulator for Hearthstone is currently available on the Apple App store for $0.00, and you can see the details of it here:


Deck Simulator for Hearthstone’s “HELO” rating system

Initially I thought it would be fun to write a simulator which implemented all the rules of Blizzard’s excellent Hearthstone game, and allowed me to experiment with different types of strategies. But the more I work on this project the more I try to think about how others might use this app to enhance their Hearthstone experience.

Playing virtual games of various decks is interesting, and can help you tune a deck to perform better in actual games. But I have a feeling that many people don’t want to execute several runs of simulations and then try and compare the results, since this can be a tedious process with various levels of interpretation. The deck simulator is an experimental workbench for Hearthstone cards, after all.

However, I thought it would be nice if there was an easy way to grasp a deck’s strength, something which would allow a ballpark understanding of it with a single glance.

What I came up with is “HELO”, which stands for “Hearthstone Elo”, where “Elo” is the rating system commonly used in many competitive games, such as chess.

The actual algorithm and it’s analysis can get a bit complicated, but in a nutshell it works by maintaining a rating of strength which decreases when you loose and increase when you win. The amount of ratings adjustment is proportional to the rating of the opponent, and the number of games played by both also factors in.

Deck Simulator for Hearthstone manages this rating for each deck in the system, which is updated after each game and stored for later. The rating is displayed in three places:

  • On the ‘Edit Decks’ screen (bottom right), where it is listed next to the total number of games played in parenthesis (Ex: 1568 (10000)).
  • On the ‘Simulation’ screen’s game results, on the far left in brackets (Ex: [1805])
  • On the Participants detail window which appears when you click on a specific participant on the Simulation screen.

For all decks which come with the app when you download it I’ve already ran some simulations and generated their HELO score, and also configured things so they don’t change much. If you create a new deck it will start with a default rating of ‘1500’, and for the first few hundred games it can change greatly depending on how it performs in the simulator. The most important thing is not the number itself, but how it compares to the existing decks in the database.

One of the challenges with this feature is that the performance of a deck depends on not only the deck composition but also the strategy used by the AI player. I could have added separate ratings for each AI player as well and combined ratings, but to keep things simple I just have generated the existing ratings using only ‘Evl Planner (med)’, which is usually the strongest AI. You can use any AI you like, but for direct comparison you should use the same AI player to the extent possible. If you want to reset a deck’s rating you can simply copy that deck (use the green “Copy Deck” button on the “Edit Decks” screen) and it will start over at a rating of 1500 and 0 games. Another thing to keep in mind is that the rating is not reset when you modify a deck, so if you planning to make serious modifications to a deck you might want to copy it first you can compare the before and after, and have a proper rating for both.

An interesting thing about HELO is that sometimes it doesn’t match up with the overall win percentages of a simulation run (even if all the decks started fresh). The reason for this is that a higher win percentage (say, when comparing two decks) means “this deck won more overall games than this deck”, but a higher HELO means “this deck beat other decks with relatively higher ratings than this other deck”. So you can imagine a generalist deck that is designed to win as often as possible (versus any opponent), versus a specific counter deck targeting the stronger decks, and these would have different HELO vs win rates.

Please try out the latest version (1.2) on the Apple app store (link here) and let me know what you think of the rating system.

If you happen to find a deck over 1900 or so (the highest in the database at present), drop me a line as I’m curious to see it’s composition.



Deck Simulator for Hearthstone – iTunes – Apple

Deck Simulator for Hearthstone V1.2 Released on Apple App Store!

I’m very happy to announce Deck Simulator for Hearthstone‘s 3rd version (1.2) is now available on the Apple App store!

For this release I decided to take a break from adding new cards and focus on adding a few features that will make the tool easier to use and more productive.

For example, I’ve added a very cool feature that allows you to evaluate to what extent each card in a deck is contributing to it’s overall strength, and also added a rating system for decks to easily compare them (HELO = Hearthstone ELO).

For full details of the release please see the app’s page here:


The app is currently completely free, with no ads, though will only be this way for a limited time.

I’ll be writing some more posts in the feature highlighting some of these new features and discussing how to use them.

Deck Simulator for Hearthstone V1.1 released!

I’m very happy to announce V1.1 of Deck Simulator for Hearthstone has been approved by Apple and is currently available on iTunes as an iPad app.

The main purpose of this release was to address a few crashes that I discovered, and also reduce memory used by the simulator. This allows longer simulations to be run without them being stopped due to lack of memory.

One of the crashes occurred when attempting to play a simulation with a deck containing 29 or less cards. I fixed this so it doesn’t crash, but instead gives a warning so you know you are testing a non-legal deck. I decided to allow this because making decks with less than 30 cards can be fun, and even useful when doing deck construction. I’m sure some of you wondered what would happen if you could create a small deck with only a few cards, and now you can actually see how strong such decks would be.

Another bug I fixed was where the default simulation type was “All play all”, even though the button showed “All play first” selected.

I decided to add an extra bonus which is all the cards for the Warlock class (previously they were not in the database), as well as three sample Warlock decks to play around with.

I’m already working on the next release and hope to have that out in a few weeks, but in the meantime try out the latest version and enjoy!

Decks included in the simulator’s database and deck evolution

The Deck Simulator for Hearthstone app includes a database of decks that are intended to be used as comparison points against decks you make, with the goal of classifying their strength. These were mostly made by myself, my friends, or from decks I picked up online somewhere. However three of the decks included were designed with the help of an evolutionary algorithm that I created:

  • Evolved Paladin 205
  • Evolved Paladin 215
  • Evolved Warrior

Describing the entire algorithm in detail would be be quite lengthy, so for now I’ll just describe it briefly from a high level:

1) Create a bunch of decks with random cards

2) Play a single-elimanation tournament until the winner is decided, and rank the decks by their win rate

3) Get rid of the lower-ranking decks and replace them with mutated versions of the higher-ranking decks. For example I might remove or replace a random card or two

4) Go back to step #2

After going through the process through hundred of iterations (tournaments), if things went well the winning decks should be quite strong. It took a lot of trial and error and parameter tweaking, but eventually I ‘evolved’ a few decks that weren’t so bad. The above three are some of the better ones from that group.

I’m not going to give the full deck lists here, but if you are curious please consider downloading the app on iTunes . I will say that their crafting cost isn’t cheap (two of the decks are over 9000). Also it’s interesting that all three of them just happen to have Ragnaros the Firelord (one of my favorite cards).

I haven’t tried any of these decks in real games online, but if you happen to own the cards feel free to try them out and let me know how they perform.



Artificial Intelligence types in Deck Simulator for Hearthstone

The evaluation of deck strength done by the simulator is critically dependent on the brains behind the computer-controlled players which are making the decisions at each turn. The types of choices that have to be made include:

  • What cards should be redrawn at the beginning of the game?
  • What cards should I play?
  • What target(s) should I choose for spells and effects?
  • What minions should I attack with and whom should I target (other minions or the enemy player)?
  • For “choose-one” type spells, which spell should be used?

As of the current version of the game, there are 7 different types of AI players available when you configure a simulation. However, for the most part these can be divided into two types of play style, Heuristic and Planner.

Heuristic style is where I have handpicked a bunch of rules (around 30) to control different aspects of the game. For example, when there are no Taunt minions in play, should I attack the enemy player directly or try to kill his/her minions first? Should I only play minions when their battle cries have a valid target, or play them as soon as I can? There are a bunch of heuristics like this that I created one-by-one through many game replays and thinking about what a human would do.

The best example of the Heuristic style is the “Evolved AI (Strong)” player which is has the added benefit of a series of rules which I optimized via hundreds of iterations of a evolutionary algorithm. The process for ‘evolving’ a strong AI is not directly available in the game at present, but some day I hope to make it so.

“1st generation (weak)” is also a heuristic AI, but it is very simple with only a few rules, and is therefore very weak. I left it in mainly for historical reasons and so you can see the full effect of a good AI vs a bad one.

The other style, Planner, is significantly more advanced and involves looking at an entire turn instead of action by action. The planner looks for different possibilities in terms of the above choices (card playing, attacks, etc.) and then does a evaluation for the end result at the end of the turn after those actions are done. This allows finding multi-card combos, such as casting a spell to deal 1 damage to a enemy minions, then attacking that same minion to destroy it.

As you might guess, planner AI types are generally stronger than heuristic AI, however they take more time because of the many scenarios that have be evaluated each turn. “Evolved Planer (quick)” and “Evolved Planner (med)” are two examples of this AI type, where the first looks at a relatively limited number of possibilities and the second looks at many more possibilities.  The weighting factors used for these AIs were also optimized to use evolutionary algorithms, hence the “Evolved” portion of the name.

So which AI should you use in your simulations?

If you want a quick, rough estimate of decks’ relative strengths, use the “Evolved AI (strong)”, and if you want a better estimate which will take significantly more time, use “Evolved Planner (med)”. Another drawback of Planner-style AIs is they take up much more memory, so if you run a long simulation with many participants there is a chance your device will run out of memory and the simulation will be stopped automatically. In that case you can try with less participants, less matches per pairing, or without Planner-style AIs.

I spent a good portion of my time optimizing these AIs to make them strong, although there are still cases where they will not always make the best plays. Fortunately, I noticed that the strength ranking of a few decks doesn’t seem to change too much regardless of which AI is used (excepting the “1st generation (weak)” one). I still may add the ability to tweak AI parameters in a future release just because it’s fun.