Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Player

The class for a player object

Hierarchy

  • Player

Index

Constructors

  • new Player(rating: number, rd: number, vol: number, tau: number): Player

Properties

__rating: number

Internal rating in the Glicko-2 scale

__rd: number

Internal rating deviation

__vol: number

Internal volatility

_tau: number

Internal value for Tau

adv_ranks: number[] = []

An array of the ratings of the opponents faced

adv_rds: number[] = []

An array of the rating deviations of the opponents faced

defaultRating: number = 1500

The default rating of the player Used in calculations between the Glicko scales

default

1500

id: number = 0

The id of the player

default

0

outcomes: number[] = []

An array of the outcomes the player has been in

volatilityAlgorithm: (v: number, delta: number, __namedParameters: volatilityArgs) => number = newProcedure

Type declaration

    • The volatility Algorithm for the player

      default

      newProcedure

      Parameters

      Returns number

Methods

  • _E(p2rating: number, p2RD: number): number
  • The Glicko E function.

    Parameters

    • p2rating: number
    • p2RD: number

    Returns number

  • _delta(v: number): number
  • The delta function of the Glicko2 system. Calculation of the estimated improvement in rating (step 4 of the algorithm)

    Parameters

    • v: number

    Returns number

  • _g(RD: number): number
  • _letiance(): number
  • Calculation of the estimated letiance of the player’s rating based on game outcomes

    Returns number

  • _preRatingRD(): void
  • Calculates and updates the player’s rating deviation for the beginning of a rating period. preRatingRD() -> None

    Returns void

  • addResult(opponent: Player, outcome: number): void
  • Adds a result to the players object

    Parameters

    • opponent: Player
    • outcome: number

      The outcome: 0 = defeat, 1 = victory, 0.5 = draw

    Returns void

  • getRating(): number
  • getRatings(): { outcomes: number[]; rating: number; rd: number; vol: number }
  • Returns { outcomes: number[]; rating: number; rd: number; vol: number }

    An object of the players rating, rating deviation, volatility and the recent outcomes

    • outcomes: number[]
    • rating: number
    • rd: number
    • vol: number
  • getRd(): number
  • getVol(): number
  • hasPlayed(): boolean
  • setRating(rating: number): void
  • Sets the rating of the player

    Parameters

    • rating: number

      The rating in Glicko format

    Returns void

  • setRd(rd: number): void
  • Sets the rating deviation of the player

    Parameters

    • rd: number

    Returns void

  • setVol(vol: number): void
  • Sets the volatility value of the player

    Parameters

    • vol: number

    Returns void

  • update_rank(): void