From 018ee29cbc2102706b44998a7768acd3cde81d79 Mon Sep 17 00:00:00 2001 From: atomflunder <80397293+atomflunder@users.noreply.github.com> Date: Fri, 16 Jun 2023 22:45:55 +0200 Subject: [PATCH] Add default values to documentation --- README.md | 7 +++++-- src/dwz.rs | 1 + src/elo.rs | 2 +- src/fifa.rs | 4 +++- src/glicko.rs | 2 +- src/glicko2.rs | 4 +++- src/glicko_boost.rs | 4 +++- src/ingo.rs | 1 + src/lib.rs | 9 ++++++--- src/sticko.rs | 4 +++- src/trueskill.rs | 4 +++- src/uscf.rs | 2 ++ src/weng_lin.rs | 4 +++- 13 files changed, 35 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index f2833d0..fd59f77 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ use skillratings::{ }; // Initialise a new player rating. -// The default values are: 1500.0, 350.0, and 0.06. +// The default values are: 1500, 350, and 0.06. let player_one = Glicko2Rating::new(); // Or you can initialise it with your own values of course. @@ -114,6 +114,7 @@ use skillratings::{ }; // We initialise Team One as a Vec of multiple TrueSkillRatings. +// The default values for the rating are: 25, 25/3 ≈ 8.33. let team_one = vec![ TrueSkillRating { rating: 33.3, @@ -163,6 +164,7 @@ use skillratings::{ // Initialise the teams as Vecs of WengLinRatings. // Note that teams do not necessarily have to be the same size. +// The default values for the rating are: 25, 25/3 ≈ 8.33. let team_one = vec![ WengLinRating { rating: 25.1, @@ -224,7 +226,7 @@ This example is using *Glicko* (*not Glicko-2!*) to demonstrate. use skillratings::glicko::{expected_score, GlickoRating}; // Initialise a new player rating. -// The default values are: 1500.0, and 350.0. +// The default values are: 1500, and 350. let player_one = GlickoRating::new(); // Initialising a new rating with custom numbers. @@ -257,6 +259,7 @@ use skillratings::{ }; // We initialise a new Elo Rating here. +// The default rating value is 1000. let player = EloRating { rating: 1402.1 }; // We need a list of results to pass to the elo_rating_period function. diff --git a/src/dwz.rs b/src/dwz.rs index 97850ac..25f167a 100644 --- a/src/dwz.rs +++ b/src/dwz.rs @@ -24,6 +24,7 @@ //! //! // Or you can initialise it with your own values of course. //! // Imagine these numbers being pulled from a database. +//! // The default rating is 1000, and the index denotes the amount of tournaments played. //! let (some_rating, some_index, some_age) = (1325.0, 51, 27); //! let player_two = DWZRating { //! rating: some_rating, diff --git a/src/elo.rs b/src/elo.rs index 8ba462f..531a820 100644 --- a/src/elo.rs +++ b/src/elo.rs @@ -15,7 +15,7 @@ //! Outcomes, //! }; //! -//! // Initialise a new player rating. +//! // Initialise a new player rating with a rating of 1000. //! let player_one = EloRating::new(); //! //! // Or you can initialise it with your own values of course. diff --git a/src/fifa.rs b/src/fifa.rs index 8224f46..6cf2c64 100644 --- a/src/fifa.rs +++ b/src/fifa.rs @@ -17,7 +17,7 @@ //! Outcomes, //! }; //! -//! // Initialise a new team rating. +//! // Initialise a new team rating with a rating of 1000. //! let team_one = FifaRating::new(); //! //! // Or you can initialise it with your own values of course. @@ -33,6 +33,8 @@ //! // The config allows you to specify certain values in the Fifa calculation. //! // Here we set the importance factor to 50.0, and the knockout factor to false. //! // Which corresponds to a World Cup Group Stage match. +//! // For more information on how to customise the config, +//! // please check out the FifaConfig struct. //! let config = FifaConfig { //! importance: 50.0, //! knockout: false, diff --git a/src/glicko.rs b/src/glicko.rs index 7dab82b..6721cf5 100644 --- a/src/glicko.rs +++ b/src/glicko.rs @@ -19,7 +19,7 @@ //! Outcomes, //! }; //! -//! // Initialise a new player rating. +//! // Initialise a new player rating with a rating of 1500 and a deviation of 350. //! let player_one = GlickoRating::new(); //! //! // Or you can initialise it with your own values of course. diff --git a/src/glicko2.rs b/src/glicko2.rs index 303e02c..552e035 100644 --- a/src/glicko2.rs +++ b/src/glicko2.rs @@ -17,7 +17,7 @@ //! Outcomes, //! }; //! -//! // Initialise a new player rating. +//! // Initialise a new player rating with a rating of 1500, a deviation of 350 and a volatility of 0.06. //! let player_one = Glicko2Rating::new(); //! //! // Or you can initialise it with your own values of course. @@ -36,6 +36,8 @@ //! // Here we set the Tau value to 0.9, instead of the default 0.5. //! // This will increase the change in volatility over time. //! // According to Mark Glickman, values between 0.3 and 1.2 are reasonable. +//! // For more information on how to customise the config, +//! // please check out the Glicko2Config struct. //! let config = Glicko2Config { //! tau: 0.9, //! ..Default::default() diff --git a/src/glicko_boost.rs b/src/glicko_boost.rs index af7de78..64bf2c8 100644 --- a/src/glicko_boost.rs +++ b/src/glicko_boost.rs @@ -30,7 +30,7 @@ //! Outcomes, //! }; //! -//! // Initialise a new player rating. +//! // Initialise a new player rating with a rating of 1500 and a deviation of 350. //! let player_one = GlickoBoostRating::new(); //! //! // Or you can initialise it with your own values of course. @@ -45,6 +45,8 @@ //! let outcome = Outcomes::WIN; //! //! // The config allows you to specify certain values in the Glicko-Boost calculation. +//! // For more information on how to customise the config, +//! // please check out the GlickoBoostConfig struct. //! let config = GlickoBoostConfig { //! // The eta value describes the advantage of player_one. //! // 30.0 is roughly accurate for playing White in Chess. diff --git a/src/ingo.rs b/src/ingo.rs index ed64230..28a9191 100644 --- a/src/ingo.rs +++ b/src/ingo.rs @@ -23,6 +23,7 @@ //! //! // Or you can initialise it with your own values of course. //! // Imagine these numbers being pulled from a database. +//! // The default rating is 230. Unlike with other algorithms, with Ingo a lower rating is more desirable. //! let (some_rating, some_age) = (150.4, 23); //! let player_two = IngoRating { //! rating: some_rating, diff --git a/src/lib.rs b/src/lib.rs index 9736ce7..4065e61 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -85,7 +85,7 @@ //! }; //! //! // Initialise a new player rating. -//! // The default values are: 1500.0, 350.0, and 0.06. +//! // The default values are: 1500, 350, and 0.06. //! let player_one = Glicko2Rating::new(); //! //! // Or you can initialise it with your own values of course. @@ -122,6 +122,7 @@ //! }; //! //! // We initialise Team One as a Vec of multiple TrueSkillRatings. +//! // The default values for the rating are: 25, 25/3 ≈ 8.33. //! let team_one = vec![ //! TrueSkillRating { //! rating: 33.3, @@ -151,7 +152,7 @@ //! // The config allows you to specify certain values in the TrueSkill calculation. //! let config = TrueSkillConfig::new(); //! -//! // The trueskill_teams function will calculate the new ratings for both teams and return them. +//! // The trueskill_two_teams function will calculate the new ratings for both teams and return them. //! let (new_team_one, new_team_two) = trueskill_two_teams(&team_one, &team_two, &outcome, &config); //! //! // The rating of the first player on team one decreased by around ~1.2 points. @@ -171,6 +172,7 @@ //! //! // Initialise the teams as Vecs of WengLinRatings. //! // Note that teams do not necessarily have to be the same size. +//! // The default values for the rating are: 25, 25/3 ≈ 8.33. //! let team_one = vec![ //! WengLinRating { //! rating: 25.1, @@ -232,7 +234,7 @@ //! use skillratings::glicko::{expected_score, GlickoRating}; //! //! // Initialise a new player rating. -//! // The default values are: 1500.0, and 350.0. +//! // The default values are: 1500, and 350. //! let player_one = GlickoRating::new(); //! //! // Initialising a new rating with custom numbers. @@ -265,6 +267,7 @@ //! }; //! //! // We initialise a new Elo Rating here. +//! // The default rating value is 1000. //! let player = EloRating { rating: 1402.1 }; //! //! // We need a list of results to pass to the elo_rating_period function. diff --git a/src/sticko.rs b/src/sticko.rs index 7ab1cff..f61e89d 100644 --- a/src/sticko.rs +++ b/src/sticko.rs @@ -27,7 +27,7 @@ //! Outcomes, //! }; //! -//! // Initialise a new player rating. +//! // Initialise a new player rating with a rating of 1500 and a deviation of 350. //! let player_one = StickoRating::new(); //! //! // Or you can initialise it with your own values of course. @@ -42,6 +42,8 @@ //! let outcome = Outcomes::WIN; //! //! // The config allows you to specify certain values in the Sticko calculation. +//! // For more information on how to customise the config, +//! // please check out the StickoConfig struct. //! let config = StickoConfig { //! // The gamma value describes the advantage of player_one. //! // 30.0 is roughly accurate for playing White in Chess. diff --git a/src/trueskill.rs b/src/trueskill.rs index 6b331f2..25d953c 100644 --- a/src/trueskill.rs +++ b/src/trueskill.rs @@ -32,7 +32,7 @@ //! Outcomes, //! }; //! -//! // Initialise a new player rating. +//! // Initialise a new player rating with a rating of 25, and an uncertainty of 25/3 ≈ 8.33. //! let player_one = TrueSkillRating::new(); //! //! // Or you can initialise it with your own values of course. @@ -51,6 +51,8 @@ //! // This means that in our game, draws will be very rare to occur. //! // Change this value to reflect the outcomes of your game. //! // For example in chess, it might be a good idea to increase this value. +//! // For more information on how to customise the config, +//! // please check out the TrueSkillConfig struct. //! let config = TrueSkillConfig { //! draw_probability: 0.05, //! ..Default::default() diff --git a/src/uscf.rs b/src/uscf.rs index 48e7b4d..cb0f2a7 100644 --- a/src/uscf.rs +++ b/src/uscf.rs @@ -34,6 +34,8 @@ //! //! // 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, diff --git a/src/weng_lin.rs b/src/weng_lin.rs index f2f3889..1d97f74 100644 --- a/src/weng_lin.rs +++ b/src/weng_lin.rs @@ -22,7 +22,7 @@ //! Outcomes, //! }; //! -//! // Initialise a new player rating. +//! // Initialise a new player rating with a rating of 25, and an uncertainty of 25/3 ≈ 8.33. //! let player_one = WengLinRating::new(); //! //! // Or you can initialise it with your own values of course. @@ -42,6 +42,8 @@ //! // to achieve a ~67% win-rate over another player. //! // Lower this value if your game is heavily reliant on pure skill, //! // or increase it if randomness plays a big factor in the outcome of the game. +//! // For more information on how to customise the config, +//! // please check out the WengLinConfig struct. //! let config = WengLinConfig { //! beta: 25.0 / 12.0, //! ..Default::default()