Saturday, October 20, 2018

Interlude: Pokemon Hexagons

Happy Celebration of Mind Day! In the spirit of Martin Gardner, let's do some mathematics that's as approachable and intuitive as possible.

Let's take a little break from the Rose problems and talk about Pokemon. Love the games to this day, especially all the self-imposed challenges you can do. So, I was very excited to see graphics of Pokémon stat spreads as hexagons in an article recently, and of course it immediately got me thinking of a math problem.

For those of you who don’t know much about Pokémon, all species of Pokémon have “base stats”, which are measures of their competency in various areas. Each Pokémon has a stat for HP (Hit Points), Attack, Defense, Special Attack, Special Defense, and Speed. Base stats don’t seem to necessarily have an upper limit, but the highest existing base stat is Blissey’s 255 Base HP. There are a lot of other factors that determine a Pokémon’s actual stats, but we’re only concerned about their base stats for this problem.

The question that immediately came to my mind was, which Pokémon has the stat hexagon with the most area? Which Pokémon have a lot of area despite poor stats?


Here’s some example Pokémon hexagons. The first three are Abra, Kadabra, and Alakazam – an evolutionary line of Pokémon focused on Speed and Special Attack. Below them are Rhyhorn and Rhydon, an evolutionary line focused on HP, Attack, and Defense. And on the right we see Mew and Mewtwo, the legendary Pokémon from Generation I.

The order of the stats around the hexagon are important: Rhydon has a sizeable chunk of area because its HP, Attack, and Defense are all high and they’re right next to each other. (The order was decided by the article, and I kept the same it to answer my original question.) Obviously Pokémon with higher stats, like fully evolved Pokémon and legendaries, will have hexagons of larger area. But how should we distribute stats to get the most possible area?

It was at this point that I made a guess. I don’t know many of the newer Pokémon nearly well enough to make a great guess, but my intuition told me that something with very unbalanced stats would be the best shot at getting a high area. I went with Rhyperior, Rhydon's evolution, as the non-Mega non-legendary Pokémon with the most area, because it has gargantuan Attack, Defense, and HP, but next to nothing in the other three stats.

Now that I have a guess, let’s get to solving the problem. Let’s start by expressing it mathematically: you have six nonnegative radial lengths defining a hexagon. You also have a limitation that the sum of these lengths must equal a given constant. What radial lengths can you choose to optimize the area of the final hexagon?

This particular kind of hexagon is easy to find the area of, luckily. You can break it into triangles along the radial lines, and add up the areas of the six triangles for the area of the hexagon. Even more conveniently, we can use the 1/2(ab sin(C)) equation for a triangle’s area, which spits out a very convenient formula for us to maximize: (1/2)(sin 60)(ab + bc + cd + de + ef + fa). We can ignore the constant, because 2x will always be greater than 2y if x > y, so that leaves us with (ab + bc + cd + de + ef + fa), or the sum of adjacent products of base stats. Attack x Defense, Defense x HP, HP x Special Attack, and so on.

Now, how do we maximize this? Let’s try some test cases. I’ll use 600 as the base stat total, both because it’s conveniently divisible by six and because it is the actual base stat total of several Pokémon.

Case 1: Straight 100s across the board. The area of the hexagon (before the constant) is 60,000.

Case 2: 150, 50, 150, 50, 150, 50. The area is only 45,000.

Case 3: 50, 50, 50, 150, 150, 150. The area is 65,000. We’re getting warmer!

Case 4: 0, 0, 0, 200, 200, 200. The area shoots up to 80,000!

Case 5: 0, 0, 0, 0, 300, 300. The area maxes out at 90,000!

Case 6: 0, 0, 0, 0, 200, 400. We’re back to 80,000, which means we have our answer.

It turns out that a Pokémon with only Attack and Defense would have a greater hexagon area than any other distribution of its stat total! The way to maximize the sum of adjacent products of a list of six is to make two of the numbers as large as possible, and equal! Does this work with an arbitrarily large or small set? What if you used products of three numbers, like (abc + bcd + cde + ...)? Most importantly, it means my intuition was right, kinda!

I crunched the numbers (and made a little Excel tool for viewing any Pokémon’s hexagon, as well as its total area), and I was close, if not exactly right. The first non-legendary of the list, is Slaking, with a base stat total greater than most legendaries. Then there’s Garchomp, Metagross, Goodra– Pokémon known for being solid all around with maybe one exceptional stat. A heap of legendaries later, Rhyperior, the 15th non-mega non-beast non-legendary on the list. Feels like I’m having to invent rules to be right, but I’m still gonna round that up to a win. J