Skip to content

Commit

Permalink
Add default values to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
atomflunder committed Jun 16, 2023
1 parent 65176ab commit 018ee29
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 13 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/dwz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/elo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion src/fifa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/glicko.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion src/glicko2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion src/glicko_boost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/ingo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 6 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand All @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion src/sticko.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion src/trueskill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions src/uscf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion src/weng_lin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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()
Expand Down

0 comments on commit 018ee29

Please sign in to comment.