|
1 | | -const p0 = 0.7 |
2 | | -const p1 = 0.96 |
3 | | - |
4 | | -const c0 = -Math.atanh(p0) |
5 | | -const c1 = Math.atanh(p1) |
6 | | -const a = (x: number): number => (1 - Math.tanh(x)) / 2 |
7 | | -const b = (x: number): number => (a((c1 - c0) * x + c0) - a(c1)) / (a(c0) - a(c1)) |
8 | | - |
| 1 | +// rl is min challenge points |
| 2 | +// rh is max challenge points |
| 3 | +// maxSolves is usually 800 and honestly after that point it doesn't matter too much |
| 4 | +// solves is number of solves chall has |
| 5 | +// |
| 6 | +// formula im using (one curve for hard challs, one curve for easy challs: |
| 7 | +// min(max(428 * (0.995) ** solves + 75, 428 * (0.9978) ** solves, 100), 500) |
| 8 | +// |
| 9 | +// put below into desmos to see curve: |
| 10 | +// y_{2}=428\left(.995\right)^{x}+75 |
| 11 | +// y_{3}=428\left(.9978\right)^{x} |
| 12 | +// y=\min\left(\max\left(y_{2},\ y_{3},\ 100\right),\ 500\right) |
9 | 13 | export const getScore = (rl: number, rh: number, maxSolves: number, solves: number): number => { |
10 | | - const s = Math.max(1, maxSolves) |
11 | | - const f = (x: number): number => rl + (rh - rl) * b(x / s) |
12 | | - return Math.round(Math.max(f(solves), f(s))) |
| 14 | + const hardCurve = 428 * (0.995) ** solves + 75; |
| 15 | + const easyCurve = 428 * (0.9978) ** solves; |
| 16 | + const veryEasyCurve = -0.055 * solves + 150; |
| 17 | + return Math.round(Math.min(Math.max(hardCurve, easyCurve, veryEasyCurve, rl), rh)); |
13 | 18 | } |
0 commit comments