Formula to calculate Pokemon Go CP and HP?
Solution 1:
"CPScalar" is an incidental constant which varies by level range. Breaking this particular value out from its exponent and level coefficient (as per level*(CPScalar)^2
) isn't actually productive, it's just a bit of unsimplified work showing through from how the value was reverse engineered.
In truth, that component of the formula can be consolidated in a piecemeal function of level. As per reddit user __isitin__
(whom your linked article also cites), the definitions for this function appear to be:
- At levels 1-10:
f(lvl) = ( 0.01885225 * level ) - 0.01001625
- At levels 11-20:
f(lvl) = ( 0.01783805 * ( level - 10 ) ) + 0.17850625
- At levels 21-30:
f(lvl) = ( 0.01784981 * ( level - 20 ) ) + 0.35688675
- At levels 31-40:
f(lvl) = ( 0.00891892 * ( level - 30 ) ) + 0.53538485
Keep in mind that pokemon get two increments for every player level, so a level input of, say, 11.5, for example, is legitimate.
This function should fit into the CP formula like so:
Attack * sqrt{Defense} * sqrt{Stamina} * f(lvl) / 10
I'm certain there are some imprecise breakpoints in there where I've discounted rounding steps or added my own. I wouldn't be surprised if the underlying function is actually founded on different (but similar) ratios, either. But unless I've made a mistake, these numbers should be accurate to the greatest practical degree.
Solution 2:
CP multipliers are values that appear directly in the game code, though only whole number levels are listed in the code. To calculate the half level values, you can use the formula from this GamePress article.
I doubt that any IV checkers actually calculate the values, instead, they likely look them up from a table.