import { volatilityArgs } from '../algorithms/volatility'; /** * The class for a player object */ declare class Player { /** * Internal value for Tau */ private _tau; /** * Internal rating in the Glicko-2 scale */ private __rating; /** * Internal rating deviation */ private __rd; /** * Internal volatility */ private __vol; /** * An array of the ratings of the opponents faced */ adv_ranks: number[]; /** * An array of the rating deviations of the opponents faced */ adv_rds: number[]; /** * An array of the outcomes the player has been in */ outcomes: number[]; /** * The default rating of the player * Used in calculations between the Glicko scales * @default 1500 */ defaultRating: number; /** * The id of the player * @default 0 */ id: number; /** * The volatility Algorithm for the player * @default {@link newProcedure} */ volatilityAlgorithm: (v: number, delta: number, { vol, tau, rd, rating }: volatilityArgs) => number; constructor(rating: number, rd: number, vol: number, tau: number); /** * @returns The rating of the player in the Glicko format */ getRating(): number; /** * Sets the rating of the player * @param rating The rating in Glicko format */ setRating(rating: number): void; /** * @returns The rating deviation of the player */ getRd(): number; /** * Sets the rating deviation of the player */ setRd(rd: number): void; /** * @returns The volatility value of the player */ getVol(): number; /** * Sets the volatility value of the player */ setVol(vol: number): void; /** * @returns An object of the players rating, rating deviation, volatility and the recent outcomes */ getRatings(): { rating: number; rd: number; vol: number; outcomes: number[]; }; /** * Adds a result to the players object * @param outcome The outcome: 0 = defeat, 1 = victory, 0.5 = draw */ addResult(opponent: Player, outcome: number): void; /** * Calculates the new rating and rating deviation of the player. * Follows the steps of the algorithm described at http://www.glicko.net/glicko/glicko2.pdf */ update_rank(): void; /** * @returns A boolean value of if the player has played a game */ hasPlayed(): boolean; /** * Calculates and updates the player's rating deviation for the beginning of a rating period. * preRatingRD() -> None */ private _preRatingRD; /** * Calculation of the estimated letiance of the player's rating based on game outcomes */ private _letiance; /** * The Glicko E function. */ private _E; /** * The Glicko2 g(RD) function. */ private _g; /** * The delta function of the Glicko2 system. * Calculation of the estimated improvement in rating (step 4 of the algorithm) */ private _delta; } export { Player };