]> git.sesse.net Git - foosball/commitdiff
Adjusted initial parameters for maximum prediction power; in particular, master
authorSteinar H. Gunderson <sesse@debian.org>
Wed, 26 Dec 2007 18:05:51 +0000 (19:05 +0100)
committerSteinar H. Gunderson <sesse@debian.org>
Wed, 26 Dec 2007 18:05:51 +0000 (19:05 +0100)
fixed a long-standing off-by-86400 bug.

foosball.pm

index b5750b26bda09db32f750af5d8a3ea8458906eba..38722422caea742ec265373305a913c3e342b451 100644 (file)
@@ -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;
 }