Pokémon Go: Difference between revisions

Line 24: Line 24:
CPMs range from 0.094 to 0.8403. Non-integer Levels are always defined using the quadratic mean (root of mean of squares): CPM(L + 0.5) = √((CPM(L)<sup>2</sup> + CPM(L + 1)<sup>2</sup>) / 2), getting us down to 50 constants.
CPMs range from 0.094 to 0.8403. Non-integer Levels are always defined using the quadratic mean (root of mean of squares): CPM(L + 0.5) = √((CPM(L)<sup>2</sup> + CPM(L + 1)<sup>2</sup>) / 2), getting us down to 50 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 using seven floating-point and six integer constants in O(n) time and O(1) space:
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>
float nextcpm(float cpm, float step){
float nextcpm(float cpm, float step){