]> git.sesse.net Git - remoteglot-book/commitdiff
Mark moves that arise only due to transpositions in blue.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 14 Dec 2014 23:21:48 +0000 (00:21 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 14 Dec 2014 23:21:48 +0000 (00:21 +0100)
www/css/remoteglot.css
www/js/book.js
www/opening-stats.pl

index 110f5c827d832701ee9706ffb88132ef494a8d9c..a07fb4872641052a32391a2ccdc4ba92a429778e 100644 (file)
@@ -194,3 +194,6 @@ a.move:hover {
 .totals {
        background: rgb(90%,90%,90%);
 }
+.transponly {
+       background: rgb(90%,90%,100%);
+}
index 854d6ad6e86fb7f233b88604cefbef9bb31f2317..36a9a26183b90c3797cd6ed982022653eb14a377 100644 (file)
@@ -157,6 +157,7 @@ var show_lines = function(data, game) {
        }
 
        var lines = [];
+       var transpose_only = [];
        for (var i = 0; i < moves.length; ++i) {
                var move = moves[i];
                var line = [];
@@ -166,6 +167,7 @@ var show_lines = function(data, game) {
                var black = parseInt(move['black']);
 
                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);  // %.
@@ -214,6 +216,8 @@ var show_lines = function(data, game) {
 
                if (line[0] === undefined) {
                        $(tr).addClass("totals");
+               } else if (transpose_only[i]) {
+                       $(tr).addClass("transponly");
                }
 
                for (var j = 0; j < line.length; ++j) {
index e809088cbaf3af9f4e594c24f49560f9155f658a..3fb8946f3122fcf10fab9f73519bd801ee8ca10f 100755 (executable)
@@ -55,6 +55,12 @@ for my $move (@{$root_aux_data->{'moves'}}) {
        my $json_pos;
        if ($includetransp) {
                ($json_pos, undef) = get_json_move($np, undef, $chld_in, $chld_out);
+
+               # See if this move exists only due to transpositions.
+               my ($alt_json_pos, undef) = get_json_move($np, $root_aux_data->{'pos_hash'}, $chld_in, $chld_out);
+               if (!defined($alt_json_pos)) {
+                       $json_pos->{'transpose_only'} = 1;
+               }
        } else {
                ($json_pos, undef) = get_json_move($np, $root_aux_data->{'pos_hash'}, $chld_in, $chld_out);
        }
@@ -124,7 +130,7 @@ sub get_json_move {
        chomp (my $line = <$chld_out>);
        if ($line eq '-') {
                warn "Missing pos '" . $pos->fen . "' " . $filter_prev_pos_hash;
-               return ({}, {});
+               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;