I am a legend 5: Predicting the opponent deck

Elie Bursztein now turns it over to his wife Celine to talk about their in-game web application which can help foresee the opponent’s deck in Hearthstone.

So, let’s switch gears a little bit. We are going to tell you about how you can predict your opponent’s deck, and I’m going to let Celine tell you a little bit about that.

Celine Bursztein: Hello everybody! My name is Celine, and I’m going to show you our in-game tool (see leftmost image below). The tool is a web application written in Python. It runs on a small web server called Flask. So you can display the web page, it just takes you to your game, as you can see on the left side of the screen. You can also use any devices with a web browser, such as a tablet. This tool implements all the algorithms described in this talk, so you can benefit from them easily.

Viewing game metrics

Structure of the dashboard

The in-game tool

In the below metrics, you can see your deck (see leftmost image below). So you can see how many cards of each type you have in your deck – in the T column, so T for Total. You can also see which of them are currently on the board in green in the P column, P for Played; and how many are dead in red in the D column, so D for Dead.

Predicted deck

Opponent stats

Player’s deck

Below your deck there is the third box that says what cards your opponent played (see middle image above). Every time your opponent plays a card, it will appear in this box, the total number of cards in the T column, the played cards in the P column, and the dead cards in the D column. And the last but not least, the final box will show you a prediction of which card your opponent is going to play based on the previous cards he played (see rightmost image above).

Possible sources of data

So, how did we manage to get the data? We could use packet sniffing to get the game data; it gives you the base data and it’s a violation of Blizzard’s Terms of Service, so we didn’t use it. We could use OCR, optical character recognition; it gives you good data but it requires a lot of CPU and it’s not very reliable. So we ended up using the debug log. You can start your game in debug mode. It’s a simple method to get data but it has some limitations, like there’s only game data and you cannot see your opponent name, player rankings, which card attacked which card, and there’s no info about decks. So it would have been great if Blizzard provided a log system as good as the one in the World of Warcraft.

Hearthstone in-game tool in action

Now you will see our tool in action in a short video (see above). The tool is on the left side of the game. I’m playing against Elie. I choose my card, and you will see that Elie starts with an extra card in his hand because he has the Draw Advantage and Hand Advantage. Now I’m picking up a card, so we have the same number of cards. As you can see in the dashboard, there is no more advantage for Elie. So now I’m playing Argent Squire, and you can see the card will appear in green in my deck and I spent 1 mana point, so the Mana Advantage is for me. As the game evolves, the dashboard reflects the changes, and as soon as Elie plays a card a prediction appears at the bottom. You can collapse your deck to get more room for your opponent info. Now I’m going to play Eviscerate. Let’s take a closer look, so Eviscerate was in the prediction. So, yeah, it’s working. At some point he tries to kill me with Leeroy, and good for me I have a Knife Juggler, it saved me. So, I hope you liked it.

The ‘Turns’ screen

In addition to the real time dashboard, you can also see the current game history in the Turns screen (see right-hand image). It allows you to see what happened turn by turn during the game and learn from your mistakes. Our tool will be available next week on GitHub. We currently need help with improving deck import using OCR, because we are currently using a text file. We also want to display the game history, do the macros, Windows packaging, and improve card modeling.

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

Read next: I am a legend 6: Hearthstone card affinities