I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

169
\ I am a legend Celine & Elie Bursztein https://www.elie.net/hs

description

Slides from our talk at Defcon 22 about Blizzard new game Hearthstone. For more information: http://www.elie.net/hs Talk Abstract --------------- Want to become a legend at Hearthstone -- Blizzard's new blockbuster collecting card game -- or simply learn how to play better? Then pull up a chair by the hearth and join us for a talk about Hearthstone mechanics and how to improve your chance of winning using machine learning and data mining. This talk is packed with examples that show how to use the tools that we are releasing at Defcon. First, we will show you how to uncover the most undervalued cards by building a pricing model reflecting the cards' abilities. Next we will explain how decks can be optimized by tweaking their mana curve to maximize mana efficiency. Finally, we will cover how to predict with relatively good accuracy what opponents are likely to play turn-by-turn by data-mining game replays and building a predictive model that uses that information. Even if you've never heard of Hearthstone before (shame on you!), you should still come to to the talk. That's because it's fun and the techniques discussed can help you improve your performance on other collectible cards games including Magic.

Transcript of I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Page 1: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

\

I am a legendCeline & Elie Bursztein

https://www.elie.net/hs

Page 2: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Digital Collectible Card Game

Released by Blizzard in 2014

Based of World of Warcraft universe

Page 3: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Sometimes too interesting leads to un-intended consequences

Painting by http://www.jason-w.com/blog/the-fall-of-lordaeron

Page 4: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Game complexity generates exploitable biases

Page 5: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Outline

Page 6: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Outline

1. Finding undervalued cards

Page 7: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Outline

1. Finding undervalued cards

2. Predicting opponent deck

Page 8: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Outline

1. Finding undervalued cards

2. Predicting opponent deck

3. Predicting the game outcome

Page 9: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Outline

1. Finding undervalued cards

2. Predicting opponent deck

3. Predicting the game outcome

4. Incoming alien invasion (or not)

Page 10: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Page 11: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

You hero

Page 12: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

You hero

Opponent hero

Page 13: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Hero health

Page 14: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Deck

Page 15: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

hand

Page 16: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

hand

Page 17: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

mana pool

Page 18: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Weapon

Page 19: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Minions

Page 20: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

video of a turn

Page 21: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

video of a turn

Page 22: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Page 23: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Page 24: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Mana

Page 25: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Mana

Attack

Page 26: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Mana

Attack Health

Page 27: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Card special abilities is what makes the game complex and interesting

Page 28: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Card special abilities is what makes the game complex and interesting

Page 29: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

\

Finding undervalued cards

Page 30: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Model assumptions

Page 31: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

1. Mana cost is proportional to card power

Model assumptions

Page 32: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

1. Mana cost is proportional to card power

2. The power of cards roughly increase linearly

Model assumptions

Page 33: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

1. Mana cost is proportional to card power

2. The power of cards roughly increase linearly

3. Card effects have constant price

Model assumptions

Page 34: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

1. Mana cost is proportional to card power

2. The power of cards roughly increase linearly

3. Card effects have constant price

4. A card have an intrinsic value

Model assumptions

Page 35: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

1. Mana cost is proportional to card power

2. The power of cards roughly increase linearly

3. Card effects have constant price

4. A card have an intrinsic value

5. The value of the card is the sum of its attribute

Model assumptions

Page 36: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

= +mana attack +health intrinsic value

Page 37: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

= +mana attack +health intrinsic value4 4a + i= + 5h

Page 38: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Page 39: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

6 = 6a + 7h + i

Page 40: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

6 = 6a + 7h + i

Page 41: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

6 = 6a + 7h + i 4 = 4a + 5h + i

Page 42: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

6 = 6a + 7h + i 4 = 4a + 5h + i/6

Page 43: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

6 = 6a + 7h + i

1 = 1a + 1.16h + i

4 = 4a + 5h + i/6

Page 44: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

6 = 6a + 7h + i

1 = 1a + 1.16h + i

4 = 4a + 5h + i/6 /4

Page 45: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

6 = 6a + 7h + i

1 = 1a + 1.16h + i

4 = 4a + 5h + i

1 = 1a + 1.25h + i

/6 /4

Page 46: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Page 47: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

4 = 6d

Page 48: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

4 = 6d 1 mana = 1.5 dmg

Page 49: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

4 = 6d 1 mana = 1.5 dmg

Page 50: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

4 = 6d

10 = 10d

1 mana = 1.5 dmg

Page 51: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

4 = 6d

10 = 10d 1 mana = 1 dmg

1 mana = 1.5 dmg

Page 52: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

4 = 6d

10 = 10d 1 mana = 1 dmg

Pre nerf (8 mana)

1 mana = 1.5 dmg

Page 53: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

4 = 6d

10 = 10d 1 mana = 1 dmg

8 = 10dPre nerf (8 mana)

1 mana = 1.5 dmg

Page 54: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

4 = 6d

10 = 10d 1 mana = 1 dmg

8 = 10d 1 mana = 1.25 dmgPre nerf (8 mana)

1 mana = 1.5 dmg

Page 55: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Page 56: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

10 damages 4 damagesimply

Page 57: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

15 damages 6 damages

10 damages 4 damagesimply

imply

Page 58: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Hunting for under-valued cards

Page 59: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

How to find undervalued cards?

Model cards

Page 60: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

How to find undervalued cards?

Model cards

Reverse coefficients

Page 61: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

How to find undervalued cards?

Model cards

Compute cards real value

Reverse coefficients

Page 62: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

How to find undervalued cards?

Model cards

Compute cards real value

Reverse coefficients

Profit :)

Page 63: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Simple 5 cards example

Use simpler coefficientsApproach illustrated

Page 64: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Charge

Page 65: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Charge Divine shield

Page 66: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Page 67: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

4 = 4a + 3h + c + i

Page 68: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

4 = 4a + 3h + c + i

6 = 5a + 2h + c + i

6 = 4a + 2h + c + d + i

3 = 3a + 1h + d + i

1 = 1a + 1h + d + i

Page 69: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Reversing attribute cost

Page 70: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Reversing attribute cost

Page 71: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Reversing attribute cost

mana Atk Health Charge Divine Intrinsic

Page 72: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Reversing attribute cost

mana Atk Health Charge Divine Intrinsic

4 4 3 1 0 1

Page 73: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Reversing attribute cost

mana Atk Health Charge Divine Intrinsic

4 4 3 1 0 1

6 5 2 1 0 1

Page 74: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Reversing attribute cost

mana Atk Health Charge Divine Intrinsic

4 4 3 1 0 1

6 5 2 1 0 1

6 4 2 1 1 1

Page 75: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Reversing attribute cost

mana Atk Health Charge Divine Intrinsic

4 4 3 1 0 1

6 5 2 1 0 1

6 4 2 1 1 1

3 3 1 0 1 1

Page 76: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Reversing attribute cost

mana Atk Health Charge Divine Intrinsic

4 4 3 1 0 1

6 5 2 1 0 1

6 4 2 1 1 1

3 3 1 0 1 1

1 1 1 0 1 1

Page 77: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Reversing attribute cost

mana Atk Health Charge Divine Intrinsic

4 4 3 1 0 1

6 5 2 1 0 1

6 4 2 1 1 1

3 3 1 0 1 1

1 1 1 0 1 1

Least square

Page 78: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Reversing attribute cost

mana Atk Health Charge Divine Intrinsic

4 4 3 1 0 1

6 5 2 1 0 1

6 4 2 1 1 1

3 3 1 0 1 1

1 1 1 0 1 1

Atk

Health

Charge

Divine

Intrinsic

=====

1

-1

2

1

1

Least square

Page 79: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Reversing attribute cost

mana Atk Health Charge Divine Intrinsic

4 4 3 1 0 1

6 5 2 1 0 1

6 4 2 1 1 1

3 3 1 0 1 1

1 1 1 0 1 1

Atk

Health

Charge

Divine

Intrinsic

=====

1

-1

2

1

1

Warning these example attribute costs are bogus as we didn’t use enough cards

Least square

Page 80: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Finding card real price using reversed coefficients

Atk = 1 Health = -1Charge = 2 Divine = 1 Intrinsic = 1Coeffs:

Page 81: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Finding card real price using reversed coefficients

4a + 2h + c + d + i

Atk = 1 Health = -1Charge = 2 Divine = 1 Intrinsic = 1Coeffs:

Page 82: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Finding card real price using reversed coefficients

4a + 2h + c + d + i4*1 + 2*-1 + 2 + 1 + 1 = 6

Atk = 1 Health = -1Charge = 2 Divine = 1 Intrinsic = 1Coeffs:

Page 83: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Finding card real price using reversed coefficients

4a + 2h + c + d + i4*1 + 2*-1 + 2 + 1 + 1 = 6

Atk = 1 Health = -1Charge = 2 Divine = 1 Intrinsic = 1Coeffs:

Page 84: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Finding card real price using reversed coefficients

4a + 2h + c + d + i4*1 + 2*-1 + 2 + 1 + 1 = 6

1a + 1h + d + i

Atk = 1 Health = -1Charge = 2 Divine = 1 Intrinsic = 1Coeffs:

Page 85: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Finding card real price using reversed coefficients

4a + 2h + c + d + i4*1 + 2*-1 + 2 + 1 + 1 = 6

1a + 1h + d + i1*1 + 1*-1 + 1 + 1 = 2

Atk = 1 Health = -1Charge = 2 Divine = 1 Intrinsic = 1Coeffs:

Page 86: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Finding card real price using reversed coefficients

4a + 2h + c + d + i4*1 + 2*-1 + 2 + 1 + 1 = 6

1a + 1h + d + i1*1 + 1*-1 + 1 + 1 = 2

Atk = 1 Health = -1Charge = 2 Divine = 1 Intrinsic = 1Coeffs:

Under-valued card!

Page 87: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Redit story Thanks you for the feedback!

https://www.elie.net/hs

Page 88: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Modeling dependance between characteristics

Thanks to Niels for the idea

Page 89: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Charge = Atk * charge coeff

Windfury = Atk * windfury coeff

Divine = ? (health related?)

!

Modeling dependance between characteristics

Thanks to Niels for the idea

Page 90: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Charge = Atk * charge coeff

Windfury = Atk * windfury coeff

Divine = ? (health related?)

!

Modeling dependance between characteristics

Thanks to Niels for the idea

Model also use a card budget: 2*mana + 1

Page 91: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

oi

Et voila!

Page 92: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Reversed budget coefficientsEffect cost per pointDestroy minion 10.63Board damage 3.69Draw card 3.68Divine Shield 2.74Freeze 2.04Silence 1.66Damage 1.64Durability 1.22Stealth 1.21Attack 1.14Taunt 1.02WindFury 0.96SpellPower 0.93Health 0.81Battlecry heal 0.69Battlecry self hero heal 0.68Charge 0.65Intrinsic value 0.32

Page 93: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Reversed budget coefficientsEffect cost per pointDestroy minion 10.63Board damage 3.69Draw card 3.68Divine Shield 2.74Freeze 2.04Silence 1.66Damage 1.64Durability 1.22Stealth 1.21Attack 1.14Taunt 1.02WindFury 0.96SpellPower 0.93Health 0.81Battlecry heal 0.69Battlecry self hero heal 0.68Charge 0.65Intrinsic value 0.32

2 coeff point ~ 1 mana point

Page 94: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Reversed budget coefficientsEffect cost per pointDestroy minion 10.63Board damage 3.69Draw card 3.68Divine Shield 2.74Freeze 2.04Silence 1.66Damage 1.64Durability 1.22Stealth 1.21Attack 1.14Taunt 1.02WindFury 0.96SpellPower 0.93Health 0.81Battlecry heal 0.69Battlecry self hero heal 0.68Charge 0.65Intrinsic value 0.32

Effect Cost per pointOpponent draw card -3.97Discard cards -2.67Overload -1.68Self hero damage -0.54

2 coeff point ~ 1 mana point

Page 95: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Reversed budget coefficientsEffect cost per pointDestroy minion 10.63Board damage 3.69Draw card 3.68Divine Shield 2.74Freeze 2.04Silence 1.66Damage 1.64Durability 1.22Stealth 1.21Attack 1.14Taunt 1.02WindFury 0.96SpellPower 0.93Health 0.81Battlecry heal 0.69Battlecry self hero heal 0.68Charge 0.65Intrinsic value 0.32

Effect Cost per pointOpponent draw card -3.97Discard cards -2.67Overload -1.68Self hero damage -0.54

2 coeff point ~ 1 mana point

Page 96: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Cos

t est

imat

ed b

y th

e al

gorit

hm (i

n m

ana)

0

1

2

3

4

5

6

7

8

9

10

Cost assigned by Blizzard (in mana)0 1 2 3 4 5 6 7 8 9 10

Page 97: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Cos

t est

imat

ed b

y th

e al

gorit

hm (i

n m

ana)

0

1

2

3

4

5

6

7

8

9

10

Cost assigned by Blizzard (in mana)0 1 2 3 4 5 6 7 8 9 10

undervalued cards

Page 98: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Cos

t est

imat

ed b

y th

e al

gorit

hm (i

n m

ana)

0

1

2

3

4

5

6

7

8

9

10

Cost assigned by Blizzard (in mana)0 1 2 3 4 5 6 7 8 9 10

undervalued cards

overpriced cards

Page 99: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Model found a couple of clearly undervalued cards :)

Cos

t est

imat

ed b

y th

e al

gorit

hm (i

n m

ana)

0

1

2

3

4

5

6

7

8

9

10

Cost assigned by Blizzard (in mana)0 1 2 3 4 5 6 7 8 9 10

undervalued cards

overpriced cards

Page 100: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Most under-valued cards (~130 cards)

Full data https://www.elie.net/tools/hearthstone/cards_value

Page 101: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Taking it to the next level

Page 102: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

• 100 000 games from May to June

• Thanks to … for it :)

• Need a longer term solution

Game replays

Page 103: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Pricing cards with unique effects

Page 104: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Page 105: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Page 106: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Cards in hand

Page 107: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Health Real Value

1 1.3

2 1.9

3 2.5

4 3

5 3.6

6 4.1

7 4.7

8 5.3

9 5.9

Cards in hand

Page 108: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

1.31.9

2.5

3.0

3.6

4.2

4.7

5.35.9

OverpricedFairUndervalued

Num

of T

wilig

ht D

rake

s m

ade

0

500

1000

1500

2000

2500

Drake Health1 2 3 4 5 6 7 8 9

Average real value 3.7

Page 109: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Twilight drake price is fair

1.31.9

2.5

3.0

3.6

4.2

4.7

5.35.9

OverpricedFairUndervalued

Num

of T

wilig

ht D

rake

s m

ade

0

500

1000

1500

2000

2500

Drake Health1 2 3 4 5 6 7 8 9

Average real value 3.7

Page 110: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Page 111: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Page 112: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Cards played

this turn

Page 113: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Edwin size Real value2/2 1.094/4 3.046/6 4.988/8 6.9210/10 8.8712/12 10.5114/14 12.7516/16 14.7018/18 16.6420/20 18.5822/22 20.53

Cards played

this turn

Page 114: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

1.1

3.0

Over-pricedFairUndervalued

5.06.9

8.9

10.8

12.8

14.7

16.6 18.620.5 22.5 24.4 26.4

Num

of V

anCl

eef m

ade

0

100

200

300

400

500

600

700

800

VanCleef size (atk/hp)2/2 4/4 6/6 8/8 10/10 12/12 14/14 16/16 18/18 20/20 22/22 24/24 26/26 28/28

Page 115: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

1.1

3.0

Over-pricedFairUndervalued

5.06.9

8.9

10.8

12.8

14.7

16.6 18.620.5 22.5 24.4 26.4

Num

of V

anCl

eef m

ade

0

100

200

300

400

500

600

700

800

VanCleef size (atk/hp)2/2 4/4 6/6 8/8 10/10 12/12 14/14 16/16 18/18 20/20 22/22 24/24 26/26 28/28

Average real value 8.1

Page 116: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

VanCleef is undervalued, a fair price is probably between 5 and 7 mana

1.1

3.0

Over-pricedFairUndervalued

5.06.9

8.9

10.8

12.8

14.7

16.6 18.620.5 22.5 24.4 26.4

Num

of V

anCl

eef m

ade

0

100

200

300

400

500

600

700

800

VanCleef size (atk/hp)2/2 4/4 6/6 8/8 10/10 12/12 14/14 16/16 18/18 20/20 22/22 24/24 26/26 28/28

Average real value 8.1

Page 117: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Page 118: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Page 119: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Num Minions

Page 120: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Num Minions

Damage Value

4 6.5

8 13.9

12 21.3

16 28.6

20 36.0

24 43.4

28 50.7

Board damage coeff

Page 121: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Num Minions

Page 122: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Num Minions

Normal damage coeff

Damage Real Value

4 2.43835

8 5.71835

12 8.99835

16 12.27835

20 15.55835

24 18.83835

28 22.11835

Page 123: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Flamestrike price is fair Don’t split board damage and single damage coeff

2.4

5.7

9.0

12.3

15.6

18.822.1

Over-pricedUndervalued

Num

of F

lam

estik

e ca

sted

0

10

20

30

40

50

60

70

80

90

100

110

120

130

140

Potential damage4 8 12 16 20 24 28

Page 124: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Predicting cards

Predicting opponent deck

Page 125: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Celine

Page 126: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Celine

Our tool :)

Page 127: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

My deck with card tracking

Game metrics

Opponent cards played so far

Opponent next cards prediction

Real time dashboard

Page 128: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Game metrics

MeOpponent

Page 129: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

My deck

T = TotalP = PlayedD = Dead

Page 130: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

My opponent

T = TotalP = PlayedD = Dead

Page 131: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Predictions

Page 132: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Game data from

Page 133: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Sniff packets

Game data from

Page 134: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Sniff packets

OCRGame data from

Page 135: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Sniff packets

OCR

Debug log

Game data from

Page 136: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Sniff packets

OCR

Debug log

Game data from

Real logs from Blizzard like in WoW ?

Page 137: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Demo video

https://www.youtube.com/watch?v=--byrlBQLCY

Page 138: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Demo video

https://www.youtube.com/watch?v=--byrlBQLCY

Page 139: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Turn by Turn History

Page 140: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Available on Github LightWind/hearthstone-dashboard

Page 141: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Naxx new cards made the meta to unstable to be predicted accurately for now

Page 142: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Anatomy of our prediction system

Model card affinities

Page 143: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Anatomy of our prediction system

Model card affinities

Evaluate affinities

Page 144: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Anatomy of our prediction system

Model card affinities

Learn from replays

Evaluate affinities

Page 145: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Anatomy of our prediction system

Model card affinities

Learn from replays

Evaluate affinities

Profit :)

Page 146: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Modeling cards affinities

Page 147: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Cards bigrams

Page 148: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Cards bigrams

Page 149: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Cards bigrams

Page 150: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Cards un-ordered bigrams

Page 151: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Evaluate cards affinities

Page 152: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Played

Page 153: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Played

Page 154: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Played Bi-grams

Page 155: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Played

500

Bi-grams

Page 156: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Played

500

350

Bi-grams

Page 157: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Played

500

400

350

Bi-grams

Page 158: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Played

400

500

400

350

Bi-grams

Page 159: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Played

400

500

400

350

Bi-grams Ranked Predictions

Page 160: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Played

400

500

400

350

Bi-grams

750

Ranked Predictions

Page 161: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Played

400

500

400

350

Bi-grams

500

750

Ranked Predictions

Page 162: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Played

400

500

400

350

Bi-grams

500

750

400

Ranked Predictions

Page 163: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Training: 45000 replays

Testing : 5000 replays

1 model per class

Training and evaluation

Page 164: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Suspense is killing me

Page 165: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

97% success rate for best prediction by turn 3

Page 166: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Best predictionAverage10th prediction

Prob

abilit

y pr

edic

tions

will

be p

laye

d

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

Turn2 3 4 5 6 7 8 9 10

Page 167: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Best predictionAverage10th prediction

Prob

abilit

y pr

edic

tions

will

be p

laye

d

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

Turn2 3 4 5 6 7 8 9 10

Page 168: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Predicting game outcome

How to optimize deck for mana-throughput

Hero powers comparison

Comparing decks typesWhat’s next?

Page 169: I am a legend: Hacking Hearthstone with machine learning - Defcon 22 talk slides

Celine & Elie Bursztein I am a legend - Defcon 2014 https://www.elie.net/hs

Thank you! https://www.elie.net/hs & @elie/@cealtea on Twitter

http://swiatgry.pl/tapety/pc/5488,hearthstone_heroes_of_warcraft