Pokémon Go: Difference between revisions
| Line 20: | Line 20: | ||
===CPM=== | ===CPM=== | ||
''CP multipliers'' are defined at increments of 0.5 for all Levels 1 through 50 (plus a few more), constant across all species and stats. Powering up a Pokémon increases its Level by 0.5. The ''half-level'' is ''L * 2 - 1'', i.e. Level 3 is half-level 5. | ''CP multipliers'' are defined at increments of 0.5 for all Levels 1 through 50 (plus a few more), constant across all species and stats. Powering up a Pokémon increases its Level by 0.5. The ''half-level'' is ''L * 2 - 1'', i.e. Level 3 is half-level 5. This suggests 99 constants (but the bitch ain't one). | ||
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). | 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. | ||
We can define all 99 half-level CPMs recursively using | There are five regimes of growth: 1–9.5, 10–19.5, 20–29.5, 30–39.5, and 40+. 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: | ||
<syntaxhighlight> | <syntaxhighlight> | ||
float nextcpm(float cpm, float step){ | float nextcpm(float cpm, float step){ | ||
| Line 32: | Line 32: | ||
// halflevel: positive integer less than 100 equal to L * 2 - 1 | // halflevel: positive integer less than 100 equal to L * 2 - 1 | ||
float cpm(int halflevel){ | float cpm(int halflevel){ | ||
if(halflevel >= 79){ // Level 40 and above | if(halflevel >= 79){ // Level 40 and above are computed directly | ||
return 0. | return 0.0025 * (halflevel - 39) + 0.7903; | ||
}else if(halflevel >= 59){ // Level 30..39 | }else if(halflevel >= 59){ // Level 30..39 | ||
step = 0.00445946079; | step = 0.00445946079; | ||