X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=www%2Findex.pl;h=697470cdd75a6002c92ed6b2919bef3b15258007;hb=8964d30bbe836e9c0989208be582d3c7213eb574;hp=b96058d341677c82ce8218f89de827f1c4c990a1;hpb=b10dcb3b745f750a374dd0a4d8be2c77113543ba;p=wloh diff --git a/www/index.pl b/www/index.pl index b96058d..697470c 100755 --- a/www/index.pl +++ b/www/index.pl @@ -177,6 +177,10 @@ sub get_covariance_matrix { sub write_parms_to_file { my ($aux_parms, $match_stddev, $used_ratings, $used_cov) = @_; + POSIX::setlocale(&POSIX::LC_ALL, 'nb_NO.UTF-8'); + + my @sorted_players = sort { $players{$a} cmp $players{$b} } keys %players; + POSIX::setlocale(&POSIX::LC_ALL, 'C'); my $tmpnam = POSIX::tmpnam(); @@ -186,7 +190,7 @@ sub write_parms_to_file { printf MCCALC "%f\n", $match_stddev; printf MCCALC "%d\n", scalar keys %players; - for my $id (keys %players) { + for my $id (@sorted_players) { my $rating = $used_ratings->{$id} // 500.0; printf MCCALC "%s %f\n", $id, $rating; } @@ -213,12 +217,26 @@ sub write_parms_to_file { return $tmpnam; } +my $num_tables = 0; + sub make_table { - my ($aux_parms, $match_stddev, $lowest_division, $used_ratings, $used_cov) = @_; + my ($aux_parms, $match_stddev, $lowest_division, $used_ratings, $used_cov, $division, $subdivision) = @_; + ++$num_tables; print <<"EOF"; - -
EOF @@ -245,7 +263,9 @@ EOF print " | NEDRYKK | \n" unless ($lowest_division); print "||
---|---|---|---|
$player | \n"; @@ -262,7 +282,12 @@ EOF ($r, $b) = ($b, $r); } - printf "%.1f%% | \n", $pn * 100.0; + my $num_total_games = ($num_games * ($num_games - 1)) / 2; + if (scalar @matches == $num_total_games || $prob{$player}->[$i - 1] == $trials) { + printf "%.1f%% | \n", $pn * 100.0; + } else { + printf "%.1f%% | \n", $pn * 100.0; + } } unless ($lowest_division) { @@ -278,6 +303,8 @@ EOF print << "EOF";