Open DeltaLeeds opened 1 year ago
fn calculate_score(real_year: f64, guessed_year: f64) -> f64 {
5000.0 * f64::exp(-f64::abs(real_year - guessed_year) as f64 / (MAX_YEAR - MIN_YEAR) as f64)
}
this is the current function @DeltaLeeds
Here's how you can test out the formula in this c playground site
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main() {
float formula_one;
float formula_two;
float formula_one_weight = 1.25;
float formula_two_weight = 0.75;
for (int delta_year = 0;delta_year<=50;delta_year++){
formula_one = 5000 - 2 * pow(delta_year,2);
formula_two = 2 * pow(50 - delta_year, 2);
float result = (formula_one * formula_one_weight + formula_two * formula_two_weight)/2;
printf("Year difference with result: %i\nFormula 1 score: %f\nFormula 2 score: %f\nResult: %f\n\n", delta_year, formula_one, formula_two, result);
}
return 0;
}
@DeltaLeeds I think scores are almost perfect but i would like to have it a bit harsher
I personally find that the score range should reach 0 when the year guessed is 50 years more or less than the actual year.
Formulas I... formulated: Δyear =
Absolute(real_year - guessed_year)
More exponential / complex formula:
Formula 1:
5000 - (2 * Δyear ^ 2)
The complex formula is somewhat interesting, the score drops further the more off you get:Problem with this formula: Smaller Δyear values have extremely lenient values compared to before. 10 years off is still 4800.
Formula 2: An inverted formula from the above where the score drop off is higher in the beginning would be:
2 * ((50 - Δyear)^2)
Problem with this formula: Smaller Δyear values drop off way too much. Getting 1 year off is losing a whopping 198 points and 6 years off is already less than 4000 points.
Solution for ideal formula: Combine the two together but weigh it more for the lenient formula so that smaller Δyear has a higher score, but a not too lenient score like in formula 1. Here is my final proposed formula:
(Formula 1 * 1.25 + Formula 2 * 0.75) / 2
Results become as follows: