diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-05-28 11:22:00 +0200 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-05-28 11:22:00 +0200 |
commit | fadcda850332f8adb0a4382da9f04f78db3f6d1a (patch) | |
tree | 2ae85c8d100110e883a53a3480e170f23011e0cd /planetwars-server | |
parent | 06ac7a370ce763c2f997b9606ca880bf3782f926 (diff) | |
download | planetwars.dev-fadcda850332f8adb0a4382da9f04f78db3f6d1a.tar.xz planetwars.dev-fadcda850332f8adb0a4382da9f04f78db3f6d1a.zip |
fix order of arguments in ranker
Diffstat (limited to 'planetwars-server')
-rw-r--r-- | planetwars-server/src/modules/ranking.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/planetwars-server/src/modules/ranking.rs b/planetwars-server/src/modules/ranking.rs index 3892383..cc81f0f 100644 --- a/planetwars-server/src/modules/ranking.rs +++ b/planetwars-server/src/modules/ranking.rs @@ -9,7 +9,7 @@ use tokio; const RANKER_INTERVAL: u64 = 60; const START_RATING: f64 = 0.0; const SCALE: f64 = 100.0; -const MAX_UPDATE: f64 = 5.0; +const MAX_UPDATE: f64 = 10.0; pub async fn run_ranker(db_pool: DbPool) { // TODO: make this configurable @@ -78,7 +78,7 @@ async fn play_ranking_match(selected_bots: Vec<Bot>, db_pool: DbPool) { for i in 0..2 { let j = 1 - i; - let scaled_difference = (ratings[i] - ratings[j]) / SCALE; + let scaled_difference = (ratings[j] - ratings[i]) / SCALE; let expected = 1.0 / (1.0 + 10f64.powf(scaled_difference)); let new_rating = ratings[i] + MAX_UPDATE * (scores[i] - expected); db::ratings::set_rating(selected_bots[i].id, new_rating, &db_conn) |