mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-17 22:29:52 +08:00
Improve Level Progression Formulas (#3368) hiserod
* improve level progression formulas Changed level progression from an exponential curve to a cubic. This prevents higher level accounts from getting bunched up around levels 100 - 120 as well as making the progression through levels 1-99 a bit slower. * fixed variable name in getXpForLevel() * not flooring getlevel result * removed one level from the function Co-authored-by: Miodec <bartnikjack@gmail.com>
This commit is contained in:
parent
9515ff9000
commit
65b837e08a
1 changed files with 18 additions and 2 deletions
|
|
@ -1181,11 +1181,27 @@ export async function getDiscordAvatarUrl(
|
|||
}
|
||||
|
||||
export function getLevel(xp: number): number {
|
||||
return Math.log(1 - ((1 - 1.0545) * xp) / 100) / Math.log(1.0545) + 1;
|
||||
return (
|
||||
Math.cbrt(
|
||||
2.7891272155157822 * xp +
|
||||
1.7320508075688772 *
|
||||
Math.sqrt(2.5930768747769397 * xp ** 2 + 678618.09453225)
|
||||
) /
|
||||
1.458938803353093 -
|
||||
86.87173353918234 /
|
||||
Math.cbrt(
|
||||
2.7891272155157822 * xp +
|
||||
1.7320508075688772 *
|
||||
Math.sqrt(2.5930768747769397 * xp ** 2 + 678618.09453225)
|
||||
) +
|
||||
0.0001
|
||||
);
|
||||
}
|
||||
|
||||
export function getXpForLevel(level: number): number {
|
||||
return Math.round(100 * Math.pow(1.0545, level - 1));
|
||||
return Math.ceil(
|
||||
0.556689342404 * level ** 3 + 99.4433106576 * level - 0.0001
|
||||
);
|
||||
}
|
||||
|
||||
export async function promiseAnimation(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue