fix order of arguments in ranker
This commit is contained in:
parent
06ac7a370c
commit
fadcda8503
1 changed files with 2 additions and 2 deletions
|
@ -9,7 +9,7 @@ use tokio;
|
||||||
const RANKER_INTERVAL: u64 = 60;
|
const RANKER_INTERVAL: u64 = 60;
|
||||||
const START_RATING: f64 = 0.0;
|
const START_RATING: f64 = 0.0;
|
||||||
const SCALE: f64 = 100.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) {
|
pub async fn run_ranker(db_pool: DbPool) {
|
||||||
// TODO: make this configurable
|
// 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 {
|
for i in 0..2 {
|
||||||
let j = 1 - i;
|
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 expected = 1.0 / (1.0 + 10f64.powf(scaled_difference));
|
||||||
let new_rating = ratings[i] + MAX_UPDATE * (scores[i] - expected);
|
let new_rating = ratings[i] + MAX_UPDATE * (scores[i] - expected);
|
||||||
db::ratings::set_rating(selected_bots[i].id, new_rating, &db_conn)
|
db::ratings::set_rating(selected_bots[i].id, new_rating, &db_conn)
|
||||||
|
|
Loading…
Reference in a new issue