This commit is contained in:
Kalle
2022-03-26 10:31:49 +02:00
parent f11be1ee69
commit aed28496bc
2 changed files with 10 additions and 2 deletions

View File

@@ -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 => ({

5
openskill.d.ts vendored
View File

@@ -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[]];
}