From 72a12f5d82a598d423c0a8f38e7e790c29ad5081 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 20 Dec 2014 00:58:39 +0100 Subject: [PATCH] Show number of computer games in the UI. --- binlookup.cpp | 7 +++---- www/js/book.js | 5 +++++ www/opening-stats.pl | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/binlookup.cpp b/binlookup.cpp index d442e42..286e831 100644 --- a/binlookup.cpp +++ b/binlookup.cpp @@ -89,10 +89,9 @@ int main(int argc, char **argv) } if (has_c) { - printf("%d %d %d %u %ld %ld %d %ld %d %ld", - c.white(), c.draw(), c.black(), c.opening_num(), - c.sum_white_elo(), - c.sum_black_elo(), + printf("%d %d %d %d %u %ld %ld %d %ld %d %ld", + c.white(), c.draw(), c.black(), c.computer(), + c.opening_num(), c.sum_white_elo(), c.sum_black_elo(), c.num_elo(), c.first_timestamp(), c.pgn_file_num(), c.pgn_start_position()); diff --git a/www/js/book.js b/www/js/book.js index 8300be6..cc948fd 100644 --- a/www/js/book.js +++ b/www/js/book.js @@ -92,6 +92,8 @@ var headings = [ [ "Move", TYPE_MOVE ], [ "Games", TYPE_INTEGER ], [ "%", TYPE_RATIO ], + [ "CGames", TYPE_INTEGER ], + [ "Comp%", TYPE_RATIO ], [ "Win%", TYPE_RATIO ], [ "WWin", TYPE_INTEGER ], [ "%WW", TYPE_RATIO ], @@ -167,12 +169,15 @@ var show_lines = function(data, game) { var white = parseInt(move['white']); var draw = parseInt(move['draw']); var black = parseInt(move['black']); + var computer = parseInt(move['computer']); line.push(move['move']); // Move. transpose_only.push(move['transpose_only']); var num = white + draw + black; line.push(num); // N. line.push(num / total_num); // %. + line.push(computer); // CGames. + line.push(computer / num); // Comp%. // Win%. var white_win_ratio = (white + 0.5 * draw) / num; diff --git a/www/opening-stats.pl b/www/opening-stats.pl index 3fb8946..aea5db8 100755 --- a/www/opening-stats.pl +++ b/www/opening-stats.pl @@ -133,11 +133,12 @@ sub get_json_move { return (undef, undef); } - my ($white, $draw, $black, $opening_num, $white_sum_elo, $black_sum_elo, $num_elo, $timestamp, $pgn_file_number, $pgn_start_position, @moves) = split / /, $line; + my ($white, $draw, $black, $computer, $opening_num, $white_sum_elo, $black_sum_elo, $num_elo, $timestamp, $pgn_file_number, $pgn_start_position, @moves) = split / /, $line; my $json_pos = { white => $white, draw => $draw, black => $black, + computer => $computer, white_avg_elo => $num_elo == 0 ? undef : $white_sum_elo / $num_elo, black_avg_elo => $num_elo == 0 ? undef : $black_sum_elo / $num_elo, num_elo => $num_elo, -- 2.39.2