Function skillratings::uscf::expected_score
source · pub fn expected_score(
player_one: &USCFRating,
player_two: &USCFRating
) -> (f64, f64)
Expand description
Calculates the expected outcome of two players based on the USCF rating algorithm.
Takes in two players as USCFRating
s and returns the probability of victory for each player as an f64
between 1.0 and 0.0.
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.
Examples
use skillratings::uscf::{expected_score, USCFRating};
let player_one = USCFRating {
rating: 1800.0,
games: 130,
};
let player_two = USCFRating {
rating: 1950.0,
games: 41,
};
let (exp_one, exp_two) = expected_score(&player_one, &player_two);
assert!(((exp_one * 100.0).round() - 30.0).abs() < f64::EPSILON);
assert!(((exp_two * 100.0).round() - 70.0).abs() < f64::EPSILON);