From 4fa00c4fbfb86465b2d50bb0b5642f00c6b9329b Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 14 Dec 2014 00:06:43 +0100 Subject: [PATCH] Show totals. --- www/css/remoteglot.css | 3 +++ www/js/book.js | 4 ++++ www/opening-stats.pl | 11 ++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/www/css/remoteglot.css b/www/css/remoteglot.css index f8d99ba..110f5c8 100644 --- a/www/css/remoteglot.css +++ b/www/css/remoteglot.css @@ -191,3 +191,6 @@ a.move:hover { background-color: black; color: white; } +.totals { + background: rgb(90%,90%,90%); +} diff --git a/www/js/book.js b/www/js/book.js index c54fb94..0b1e437 100644 --- a/www/js/book.js +++ b/www/js/book.js @@ -177,6 +177,10 @@ var show_lines = function(data, game) { var line = lines[i]; var tr = document.createElement("tr"); + if (line[0] === undefined || line[0] === null) { + $(tr).addClass("totals"); + } + for (var j = 0; j < line.length; ++j) { if (line[j] === null) { add_td(tr, ""); diff --git a/www/opening-stats.pl b/www/opening-stats.pl index a17a82f..c283248 100755 --- a/www/opening-stats.pl +++ b/www/opening-stats.pl @@ -23,6 +23,16 @@ print $chld_in $hex, "\n"; chomp (my $line = <$chld_out>); my ($white, $draw, $black, $opening_num, $white_avg_elo, $black_avg_elo, $num_elo, $timestamp, $pgn_file_number, $pgn_start_position, @moves) = split / /, $line; +my @json_moves = (); +push @json_moves, { + white => $white * 1, + draw => $draw * 1, + black => $black * 1, + white_avg_elo => $white_avg_elo * 1, + black_avg_elo => $black_avg_elo * 1, + num_elo => $num_elo * 1 +}; + my $opening = $openings{$opening_num} // 'A00: Start position'; my $root_game; @@ -47,7 +57,6 @@ eval { }; # Explore one move out. -my @json_moves = (); for my $move (@moves) { my ($np, $uci_move) = $pos->make_pretty_move($move); my $hex = unpack('H*', $np->bitpacked_fen); -- 2.39.2