From: Steinar H. Gunderson Date: Wed, 26 Dec 2007 18:05:51 +0000 (+0100) Subject: Adjusted initial parameters for maximum prediction power; in particular, X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=HEAD;p=foosball Adjusted initial parameters for maximum prediction power; in particular, fixed a long-standing off-by-86400 bug. --- diff --git a/foosball.pm b/foosball.pm index b5750b2..3872242 100644 --- a/foosball.pm +++ b/foosball.pm @@ -6,7 +6,8 @@ use POSIX; 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}); @@ -64,12 +65,10 @@ sub create_user_if_not_exists { 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; }