Module skillratings::uscf

source ·
Expand description

The USCF (US Chess Federation) Rating Algorithm, developed by Mark Glickman as an improvement on Elo.
Used to rate US Chess events in favour of Elo, and continues to be enhanced over the years.

This rating system was, just like Glicko, developed by Mark Glickman, and is thus heavily influenced by it.

This implementation of the USCF Rating System uses the formulas found in the Approximating Formulas for the US Chess Rating System document, and thus may yield slightly different calculations to the proper formulas in some circumstances, specifically if a player has 8 or less games played, with only wins or only losses.

Also, this implementation can not determine rating floors for each player, except the most basic floor.
This is due to the rating floor being determined by the all-time highest rating for each player, which we cannot know.
This is something you need to keep track of yourself, unfortunately.
The formula for calculating a rating floor (the lowest rating possible) of a player is the player’s highest ever achieved rating, subtracted by 200 points and then using the floor just below that. As of 2022, rating floors exist at every 100 point mark between 1200 and 2100.
For example, a player with an all-time highest rating of 1941 has a rating floor of 1700.

Quickstart

This is the most basic example on how to use the USCF Module.
Please take a look at the functions below to see more advanced use cases.

use skillratings::{
    uscf::{uscf, USCFConfig, USCFRating},
    Outcomes,
};

// Initialise a new player rating.
// We need to set the actual age for the player,
// if you are unsure what to set here, set this to 26.
let player_one = USCFRating::new(18);

// Or you can initialise it with your own values of course.
// Imagine these numbers being pulled from a database.
// The default rating is 1300 if you are 26 or older.
// For younger players it is the players age * 50.
let (some_rating, some_games) = (1325.0, 44);
let player_two = USCFRating {
    rating: some_rating,
    games: some_games,
};

// The outcome of the match is from the perspective of player one.
let outcome = Outcomes::WIN;

// The config allows you to specify the t value in the USCF calculation.
// It determines how easy or hard it is to gain bonus rating points.
// The recommended value changes periodically, as of right now it is 14.0.
// Here we set it to 12.0, the recommended value from 2015 to 2017.
let config = USCFConfig { t: 12.0 };

// The uscf function will calculate the new ratings for both players and return them.
let (new_player_one, new_player_two) = uscf(&player_one, &player_two, &outcome, &config);

More Information

Structs

  • Struct to calculate ratings and expected score for USCFRating
  • Constants used in the USCF Rating calculations.
  • The USCF (US Chess Federation) rating for a player.

Functions