# I am a legend 3: Looking for undervalued cards in Hearthstone

What Elie Bursztein now looks into is the process of modeling cards by attributes to determine their real values and then compare those to the face values.

Card evaluation workflow

Okay, so how do we scale that to hundreds of cards? More precisely, we were able to do 130 cards for this research, because modeling each attribute is a little bit complicated. How do we do that? Well, we model the cards as we did before. Then we use those cards and we reverse the coefficients of each ‘a’, ‘h’ and so forth using linear algebra – don’t worry, it’s not as bad as it sounds. And then we use those reversed coefficients to compute what we call the ‘real value of the card’. And the last step is the easy step, where you say, well, here’s my real value, here’s my face value, you subtract one from the other, and if it’s a negative – well, you found an undervalued card. That’s as simple as this.

Cards to be modeled

Let me show you on a very simple example – 5 cards – what it looks like (see right-hand image). And then, when we know that, I will show you the real reasons. So, let’s take 3 cards which have Charge. Charge is where, basically, you pull the card – and the card can attack as soon as it comes into play. So we have the Kor’kron, the Rocketeer and the Commander. And we are going to show 2 more cards which have Divine Shield. And the reason why the Argent Commander is in the middle is because it has both attributes. One of the ideas of having linear algebra is you can compute coefficients. As I said, this is the same price. So with 5 cards we can make it work, and that’s also why we can compare cards – because we have this very complicated interrelating.

Reversing attribute coefficients

The equations

So, we do as we did before: we put them into an equation (see leftmost image to the right). Our Kor’kron has 4 attacks, 3 health, plus ‘c’, which is a Charge coefficient, plus ‘i’, which is the intrinsic value of the card. And we do that for the 5 cards. Trust me, it’s correct. Then we are going to reverse the attribute coefficients. To do that, we put them into a matrix, which is, basically, a table (see rightmost image above). We put them like this: you say, well, for 4 mana you get 4 attacks, 3 health points, 1 Charge, 0 Divine Shields and 1 intrinsic value. Then I do the same thing for the Rocketeer; same thing for the Argent Squire, and here you can see it has Divine Shield and Charge, so you have 1 and 1. And then you add the rest of the 2 cards.

Then you apply 1 line of Python, which is the least square – and boom, you get the coefficients! The coefficients are: 1 for attack, -1 for health, 2 for Charge, 1 for Divine Shield and the intrinsic value. And I’m like: dude, that doesn’t make any sense; you can’t have a discount for health. It is because we only have 5 cards. 5 cards will not give you a good coefficient because there is too much instability. You need way more. But it’s just one of the examples.

Determining real price

Now, how do you find the real price? We are going to be back to kindergarten where you learned how to add stuff (see right-hand image). So you have 4a + 2h + c + d + i. Basically, what you do is you say, well, it’s 4*1 + 2*-1 + 2 + 1 + 1. And the price is 6. So the real value, according to our coefficient, is 6. Well, the card is fair; there is nothing different between the face value and the real value – so, not interesting.

Okay, let’s try again with one of the most undervalued cards in the game, the Argent Squire. A lot of people say it’s undervalued. Let’s try again. So it’s 1 attack, 1 health, plus Divine Shield, plus the value of the card. So it’s 1*1 + 1*-1 + 1 + 1. It’s 2. Wait, 2? No, the card is 1, right? And yeah, you’re right – that’s why it’s an undervalued card. It actually should cost twice as much. So even without the coefficients you can always see that this guy is clearly undervalued.

Undoubted dependency

I posted that online, and we got a lot of good feedback about it. The most important one we got was you should take into account dependency (see right-hand image). And that’s actually true. One of the guys pointed out that Charge would be, basically, a factor of the attack. Same thing for Windfury – we model it by taking into account the attack of the card. The one where we have a lot of debate is the Divine Shield. We don’t know what Divine Shield should be. Is it just Divine Shield as a coefficient? Is it related to health, related to attack? It’s really difficult. If you have ideas, let me know.

We also got a comment that actually a card has a budget. And the budget is 2*mana + 1. I have no idea how they came up with this. It’s absolutely reasonable, and when you do it the coefficient looks way better, it is true. I just don’t know how this guy got it, but thanks!

The coefficients

So, after writing code and debugging, you have something, you run it – and voila! You get your coefficients. These are the coefficients we got for 132 cards (see right-hand image). We used the budget idea that has been proposed, 2 coefficient points is roughly 1 mana point. Basically, destroying a minion costs you 5 mana to add to a card. Board damage costs about 1.5 mana per point. Drawing a single card costs you roughly 1.5 mana. Divine Shield is pretty expensive, it costs you almost 1 mana point, and so forth.

We also have negative coefficients, which is basically the decrease of the card price. As you expect, having your opponent drawing a card is the highest one, followed by discarding cards. And then we have overload, which is a shaman mechanism where you pay another price. So, all of this seems perfectly fine, and we are really happy. And we have this guy – board damage. We did something we thought was really clever, which was like: let’s model a single target and multiple targets coefficient as different. That is a stupid idea. I’m going to show you why in a few slides, but keep in mind that we tried.

Visualization helps

One way to visualize what it looks like is you can put it on a graph, where the X axis is how much Blizzard assigned to a card as the face value, and on the Y axis – how much the algorithm believes a card is worth (see right-hand image). On the left triangle it gives you the undervalued cards, they are in green; and the overpriced cards are on the bottom right triangle. Because we arbitrarily force cards to be easier undervalued or overvalued, you are not that interested in the ones which are at a fair price. When we model cards, the cards that have shared ability are lower value. It’s not because the algorithm favors one or the other, it’s just because when we did the modeling – and you can see it on the slide – most of them are on the left side of the graph. For higher cards they usually have special ability not captured by this model.

Results for undervalued cards

So, what is the result? One of the most undervalued cards is Soulfire. We do believe it actually should be at least 1 mana. Light’s Justice is also undervalued – there was actually a lot of discussion about this one, but then a lot of people pointed out that when you pick it into the Arena it gives you 4 attacks for 1 mana. Not surprisingly, Mortal Coil, Power Shield and Argent Squire also exploit this trap. Somehow it actually gives you something which seems reasonable to most people. The one which is a little bit bizarre is Sacrificial Pact; it’s probably a bug in the code.

And do notice we also have high value cards. The one which is probably the most powerful is the Fire Elemental, which the algorithm believes is probably 7 mana, not 6. That’s something which also has been mentioned before by people just by looking at the cards. So, somehow the algorithm gives you a reasonable result therefore we believe we are on the right track. If you want to look at the full details – all the coefficients, all the card ranks – they are on my website, you can just go there. We keep updating this. And if you have ideas on how to make it better, let us know.

Read previous: I am a legend 2: Card attributes and basic game assumptions

Read next: I am a legend 4: Pricing cards with unique effects