ttr-calculator-typescript
v1.0.12
Published
A calculator for the table tennis rating written in TypeScript.
Downloads
17
Readme
🏓 TTR Calculator
A calculator for the table tennis rating.
🔎 Input
The function calculateTTRatingMultipeOpponents(ttPlayer: TTPlayer, playedGames: TTGame[])
expects as input information about the player for whom the rating shall be calculated, and information about the game(s) that the player played in one event.
The TTPlayer
must contain (some of) the following information:
ttRating: number
: The rating of the player before having played the games.isYoungerThan21: boolean
(optional): Set totrue
if the player is younger than 21.isYoungerThan16: boolean
(optional): Set totrue
if the player is younger than 16. In this case,isYoungerThan21
must also be set totrue
.lessThan30SingleGames: boolean
(optional): Set totrue
if the player has played less than 30 single games overall.lessThan15SingleGamesOverallOrAfterYearBreak
(optional): Set totrue
if the player had a break of at least one year and has played less than 15 single games since the break.
TTGame[]
is an array of games that have been played during an event. For each game, the following information must be provided:
opponentTTRating: number
: The rating of the opponent player before having played the game.gameWasWon: boolean
: Set totrue
if the game was won.
🧮 Calculation Result
The function calculateTTRatingMultipeOpponents(ttPlayer: TTPlayer, playedGames: TTGame[])
provides the following information as result of the calculation:
updatedRating: number
: The updated rating of the player after the game(s).expectedNumberWins: number
: The number of expected wins for the game(s).winExpectations: number[]
: The winning expectation for each single TT game. The order of winning expectation is the same as the order of input TT games.ratingChange: number
: The change to the TTR value of the player.