From aed28496bc425870315032b89dd1e20e87fb5b17 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sat, 26 Mar 2022 10:31:49 +0200 Subject: [PATCH] Add tau --- app/core/mmr/utils.ts | 7 ++++++- openskill.d.ts | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/core/mmr/utils.ts b/app/core/mmr/utils.ts index 6b0d4ec17..ab441b70e 100644 --- a/app/core/mmr/utils.ts +++ b/app/core/mmr/utils.ts @@ -3,6 +3,8 @@ import { rating, ordinal, rate } from "openskill"; import { LFG_GROUP_FULL_SIZE, MMR_TOPX_VISIBILITY_CUTOFF } from "~/constants"; import { PlayFrontPageLoader } from "~/routes/play/index"; +const TAU = 0.3; + /** Get first skill object of the array (should be ordered so that most recent skill is first) and convert it into MMR. */ export function skillArrayToMMR( skills: { @@ -91,7 +93,10 @@ export function adjustSkills({ const winningTeam = playerIds.winning.map(mapToRatings); const losingTeam = playerIds.losing.map(mapToRatings); - const [ratedWinners, ratedLosers] = rate([winningTeam, losingTeam]); + const [ratedWinners, ratedLosers] = rate([winningTeam, losingTeam], { + tau: TAU, + preventSigmaIncrease: true, + }); const ratedToReturnable = (side: "winning" | "losing") => (rating: Rating, i: number): AdjustSkill => ({ diff --git a/openskill.d.ts b/openskill.d.ts index 2276acd48..7d7be487c 100644 --- a/openskill.d.ts +++ b/openskill.d.ts @@ -6,5 +6,8 @@ type Rating = { declare module "openskill" { export function rating(rating?: Rating): Rating; export function ordinal(rating: Rating): number; - export function rate(ratings: [Rating[], Rating[]]): [Rating[], Rating[]]; + export function rate( + ratings: [Rating[], Rating[]], + options: { tau: number; preventSigmaIncrease: boolean } + ): [Rating[], Rating[]]; }