Update index.html
Browse files- index.html +5 -4
index.html
CHANGED
|
@@ -2862,24 +2862,25 @@ function sanitizeAccount(acc) {
|
|
| 2862 |
// owns their own uid can still repeatedly call this with the max
|
| 2863 |
// clamp value β only a trusted backend (Cloud Function) that
|
| 2864 |
// computes match results itself can fully close this gap.
|
| 2865 |
-
const MIN_ELO_GAIN =
|
| 2866 |
-
const MAX_ELO_GAIN =
|
| 2867 |
const MAX_ELO_LOSS = -1;
|
| 2868 |
|
| 2869 |
function clampEloChange(delta) {
|
| 2870 |
const d = Number(delta) || 0;
|
| 2871 |
-
|
| 2872 |
// If it's a loss (negative number), the absolute worst it can be is -1.
|
| 2873 |
// Any loss larger than -1 (like -5, -20, -50) gets boosted to -1.
|
| 2874 |
if (d < 0) {
|
| 2875 |
return Math.max(MAX_ELO_LOSS, d);
|
| 2876 |
}
|
| 2877 |
-
|
| 2878 |
// If it's a win (positive number), clamp it between +10 and +50.
|
| 2879 |
return Math.max(MIN_ELO_GAIN, Math.min(MAX_ELO_GAIN, d));
|
| 2880 |
}
|
| 2881 |
|
| 2882 |
|
|
|
|
| 2883 |
// βββββββββββββββββββββββββββββββββββββββββββββββ
|
| 2884 |
// DISCONNECT PENALTY (online 1v1 vs. real players)
|
| 2885 |
// β’ Opponent sends no sign of life for 3 s (also before the start) -> forfeit: they lose, you win.
|
|
|
|
| 2862 |
// owns their own uid can still repeatedly call this with the max
|
| 2863 |
// clamp value β only a trusted backend (Cloud Function) that
|
| 2864 |
// computes match results itself can fully close this gap.
|
| 2865 |
+
const MIN_ELO_GAIN = 10;
|
| 2866 |
+
const MAX_ELO_GAIN = 50;
|
| 2867 |
const MAX_ELO_LOSS = -1;
|
| 2868 |
|
| 2869 |
function clampEloChange(delta) {
|
| 2870 |
const d = Number(delta) || 0;
|
| 2871 |
+
|
| 2872 |
// If it's a loss (negative number), the absolute worst it can be is -1.
|
| 2873 |
// Any loss larger than -1 (like -5, -20, -50) gets boosted to -1.
|
| 2874 |
if (d < 0) {
|
| 2875 |
return Math.max(MAX_ELO_LOSS, d);
|
| 2876 |
}
|
| 2877 |
+
|
| 2878 |
// If it's a win (positive number), clamp it between +10 and +50.
|
| 2879 |
return Math.max(MIN_ELO_GAIN, Math.min(MAX_ELO_GAIN, d));
|
| 2880 |
}
|
| 2881 |
|
| 2882 |
|
| 2883 |
+
|
| 2884 |
// βββββββββββββββββββββββββββββββββββββββββββββββ
|
| 2885 |
// DISCONNECT PENALTY (online 1v1 vs. real players)
|
| 2886 |
// β’ Opponent sends no sign of life for 3 s (also before the start) -> forfeit: they lose, you win.
|