Function skillratings::egf::expected_score_rating_period
source · pub fn expected_score_rating_period(
player: &EGFRating,
opponents: &[(EGFRating, EGFConfig)]
) -> Vec<f64>
Expand description
Calculates the expected outcome of a player in a rating period or tournament.
Takes in a players as EGFRating
and a list of opponents as a slice of Tuples of EGFRating
s and EGFConfig
s
and returns the probability of victory for each match as an Vec of f64
between 1.0 and 0.0 from the perspective of the player.
1.0 means a certain victory for the player, 0.0 means certain loss.
Values near 0.5 mean a draw is likely to occur.
📌 Important note: The parameters intentionally work different from other expected_score_rating_period functions here.
In most cases the config is not used, however it is required here, because of the handicaps that can change from game-to-game.
Examples
use skillratings::egf::{expected_score_rating_period, EGFConfig, EGFRating};
let player = EGFRating { rating: 900.0 };
let opponent1 = (EGFRating { rating: 930.0 }, EGFConfig::new());
let opponent2 = (EGFRating { rating: 730.0 }, EGFConfig::new());
let exp = expected_score_rating_period(&player, &[opponent1, opponent2]);
assert_eq!((exp[0] * 100.0).round(), 48.0);
assert_eq!((exp[1] * 100.0).round(), 62.0);