C++ implementation of iterative computations.
compute_iterative_ratings(rate_fun, player1_id, score1, player2_id, score2,
initial_ratings)
Rating function (see Details).
Integer vector of player1 identifiers.
Numeric vector of player1 score in games.
Integer vector of player2 identifiers.
Numeric vector of player2 score in games.
Numeric vector of initial ratings (see Details).
A list:
rating1Before - rating of player 1 before the game;
rating2Before - rating of player 2 before the game;
rating1After - rating of player 1 after the game;
rating2After - rating of player 2 after the game.
rate_fun
- function that takes arguments:
rating1 - rating of player1 before game;
score1 - numeric score of player1 in the game;
rating2 - rating of player2 before game;
score2 - numeric score of player2 in the game.
This function should return numeric vector of length 2: rating of player1 and player2 after the game.
player1_id
, player2_id
- integer vectors of identifiers of
players in a form of increasing numbers (1, 2, ...). Identifier 0 is
reserved for 'ghost' player. His/her rating is taken as current rating of
opponent. For two 'ghost' players ratings before and after are 0.
initial_ratings
- numeric vector of length equal to number of unique
players in player1_id
and player2_id
. In
initial_ratings[player_id - 1]
(indexing from zero) initial rating of
player with identifier 'player_id' is stored.