Pokémon Go: Difference between revisions
| Line 25: | Line 25: | ||
There are five regimes of growth: 1–9.5, 10–19.5, 20–29.5, 30–39.5, and 40+. Beginning at Level 40, CPM growth becomes linear: 0.7903 (40), 0.8103 (44), 0.8303 (48), 0.8403 (50). So CPM is perfectly fit for integral Levels 40+ by the function ''0.01 * (L - 40) / 2 + 0.7903''. We can define all 99 half-level CPMs recursively in O(n) time and O(1) space using seven floating-point and six integer constants: | There are five regimes of growth: 1–9.5, 10–19.5, 20–29.5, 30–39.5, and 40+. Beginning at Level 40, CPM growth becomes linear: 0.7903 (40), 0.8103 (44), 0.8303 (48), 0.8403 (50). So CPM is perfectly fit for integral Levels 40+ by the function ''0.01 * (L - 40) / 2 + 0.7903''. We can define all 99 half-level CPMs recursively in O(n) time and O(1) space using seven floating-point and six integer constants: | ||
<syntaxhighlight> | <syntaxhighlight lang="c"> | ||
float nextcpm(float cpm, float step){ | float nextcpm(float cpm, float step){ | ||
return sqrt(power(cpm, 2) + step); | return sqrt(power(cpm, 2) + step); | ||