fixed a long-standing off-by-86400 bug.
package foosball;
our $initial_rating = 1500.0;
-our $initial_rd = 350.0;
+our $initial_rd = 400.0;
+our $c = 22.5;
sub db_connect {
my $dbh = DBI->connect("dbi:Pg:dbname=foosball;host=127.0.0.1", "foosball", "cleanrun", {AutoCommit => 0});
return $dbh;
}
-# c=8 => RD=50 moves to RD=350 over approx. five years
-our $c = 8;
-
+# $age is in days
sub apply_aging {
my ($rd, $age) = @_;
- $rd = sqrt($rd*$rd + $c * $c * ($age / 86400.0));
+ $rd = sqrt($rd*$rd + $c * $c * $age);
$rd = $initial_rd if ($rd > $initial_rd);
return $rd;
}