X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=opening-stats.pl;fp=opening-stats.pl;h=24fdc99c1e31459d46c468df1f4f9469ba96af56;hb=f95dfda2d14615a9816ba1abb32bd240a470e228;hp=27cdee0a257de70d5a48e27a061204dfb1e7bfa2;hpb=4e78c9e91ab923c172833b7828b733b2bf89569c;p=remoteglot-book diff --git a/opening-stats.pl b/opening-stats.pl index 27cdee0..24fdc99 100755 --- a/opening-stats.pl +++ b/opening-stats.pl @@ -16,11 +16,12 @@ my $pid = IPC::Open2::open2($chld_out, $chld_in, "./binlookup", "./open.mtbl", " my $pos = Position->from_fen($fen); my $hex = unpack('H*', $pos->bitpacked_fen); print $chld_in $hex, "\n"; -my $line = <$chld_out>; -print $line; -chomp $line; +chomp (my $line = <$chld_out>); # Root position hash. +print $line, "\n"; +chomp (my $line = <$chld_out>); # Actual stats. +print $line, "\n"; my ($white, $draw, $black, $opening_num, $white_avg_elo, $black_avg_elo, $num_elo, $timestamp, $pgn_file_number, $pgn_start_position, @moves) = split / /, $line; # Explore one move out. @@ -28,6 +29,7 @@ for my $move (@moves) { my ($np, $uci_move) = $pos->make_pretty_move($move); my $hex = unpack('H*', $np->bitpacked_fen); print $chld_in $hex, "\n"; - my $line = <$chld_out>; + my $line = <$chld_out>; # Ignore position hash. + $line = <$chld_out>; print "$move $line"; }