## FANDOM

1,403 Pages

One of the core features of Diep.io is the ability to customize individual aspects of each tank, beyond the premade classes. One can upgrade health and body damage to ram enemy players, or bullet damage and reload to become a hurricane of death. However, just how many different builds are there? It's a difficult question to answer, with seemingly endless configurations of 33 points into 8 different stats. However, there is an elegant way to calculate it formulaically through mathematics. In this blog post, I'll explain this method in detail, and why it works. Note, however, that this method assumes knowledge of basic algebra, utilizing polynomials and exponents.

There isn't an easy way to simulate the ways to pick stats with typical grade-level math — after all, there are not only dozens of points to arrange, but every stat has a maximum number of points so not every basic configuration is possible. However, through the use of a technique called generating functions, one can represent the possibilities elegantly through polynomials. Here's an explanation of how they work:

Suppose for a moment that we have a much simpler case with just 2 different stats, say "Bullet Power" and "Ram Power", each with a maximum of 2 points, and 3 skill points. In each stat individually, there are three possibilities — it could have 2 points, 1 point, or no points at all. We can represent this — and read carefully, this is the lynchpin of the method — as a polynomial where the exponents represent the number of skill points put in. For the example I just gave, each stat could be represented as $x^0 + x^1 + x^2$ — think of each $x$ as a skill point, and the exponent represents how many points are put in.

Now, however, we have to consider both stats together. How do you do this? You just multiply — just like how multiple skill points were represented by multiplying the $x$'s, we represent multiple stats by multiplying each stat's polynomial equivalent together. For the scenario of having two stat bars, this gives us $(x^0 + x^1 + x^2)(x^0 + x^1 + x^2)$, or $(x^0 + x^1 + x^2)^2$. To get the number of different builds, we can just expand it, but doing the expansion by hand doesn't sound fun at all. Luckily, Wolfram|Alpha, created by the genius Stephen Wolfram who wrote three books on particle physics by the age of 14, lets us easily calculate it with the magic of digital technology — the result is $x^4 + 2x^3 + 3x^2 + 2x + 1$. Instead of each exponent showing how many skill points are used in each stat, when multiplied together each exponent represents how many skill points are used overall, combining the two stats. Meanwhile, the coefficients, or the number of terms for each power, represent the number of ways to use that many skill points, since each term is a different way to combine the upgrades in each stat.

Since we want to look at the number of ways that use all the skill points, but not going over the maximum, let's look at the $x^3$ term, which is all the ways to use up 3 skill points. The coefficient is $2$, meaning there are 2 ways to use 3 skill points. This makes sense, too, since the only way to use all 3 is to put 2 points into either one of the 2 stats and put 1 point in the other. For a better explanation of generating functions in general, see here.

Now that we've gone over a quick primer on how to use polynomials, we can start on the real stat table. There are 8 stats in the game, each of which can have up to 7 skill points normally. We can represent this as $(x^0 + x^1 + x^2 + x^3 + x^4 + x^5 + x^6 + x^7)^8$ like earlier, but with 8 stat bars that each can have anywhere from 0 to 7 points instead. Expanding this either through sheer masochism or the help of the Interwebs, we get a monstrous polynomial:

x^56 + 8 x^55 + 36 x^54 + 120 x^53 + 330 x^52 + 792 x^51 + 1716 x^50 + 3432 x^49 + 6427 x^48 + 11376 x^47 + 19160 x^46 + 30864 x^45 + 47748 x^44 + 71184 x^43 + 102552 x^42 + 143088 x^41 + 193705 x^40 + 254808 x^39 + 326124 x^38 + 406568 x^37 + 494166 x^36 + 586056 x^35 + 678588 x^34 + 767544 x^33 + 848443 x^32 + 916896 x^31 + 968976 x^30 + 1001568 x^29 + 1012664 x^28 + 1001568 x^27 + 968976 x^26 + 916896 x^25 + 848443 x^24 + 767544 x^23 + 678588 x^22 + 586056 x^21 + 494166 x^20 + 406568 x^19 + 326124 x^18 + 254808 x^17 + 193705 x^16 + 143088 x^15 + 102552 x^14 + 71184 x^13 + 47748 x^12 + 30864 x^11 + 19160 x^10 + 11376 x^9 + 6427 x^8 + 3432 x^7 + 1716 x^6 + 792 x^5 + 330 x^4 + 120 x^3 + 36 x^2 + 8 x + 1

That polynomial is utterly ridiculous, but we only need to look at the ways to use 33 skill points — $767544 x^{33}$. From the coefficient, we see that there are 767,544 different ways — now all we have to do is multiply by the number of tanks…wait, we forgot Smashers! There are three smashers (the Smasher, Landmine, Spike) that have 4 stats with up to 10 points in each, and one (the Auto Smasher) that has all 8 stats but with 10 points in each. These can be represented as $(x^0 + x^1 + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9 + x^{10})^4$ and $(x^0 + x^1 + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9 + x^{10})^8$ respectively — looking at the $x^{33}$ coefficients, we see that most Smasher classes have only 120 different ways to upgrade, but the Auto Smasher has 7,048,336 different ways — the most of any tank, thanks to its higher max upgrades in each stat.

Now it's time to put the numbers we have together to have the total number of builds in the game. There are 44 "regular" tanks, with a typical stat table. These each have 767,544 ways to upgrade. There are 3 Smasher-branch tanks with no bullet-related stats, each with a mere 120 ways to upgrade due to the paucity of stats on which to spend skill points. And finally, there's the Auto Smasher, which has more of everything and a whopping 7,048,336 different builds thanks to it. Doing the calculations, there are $44 \times 767,544 + 3 \times 120 + 1 \times 7,048,336$ or $\bold{40,820,632}$ different builds in the game! That's a shit ton of builds…but remember, most of those are probably garbage with random points in random stats in random classes that don't go together in the slightest :P

If you want to see a sampling of some actually good builds for every playable tank in the game, check out the Builds page!