selfatari_cousin(): Suggest counter-captures
[pachi/peepo.git] / tools / kgslog2gtp.pl
blob428af4a7ed19a4e27ea57e56571461ee9ac874f7
1 #!/usr/bin/perl -ln
3 # kgslog2gtp - Convert kgsGtp log file to GTP command stream
5 # The command stream contains two special GTP commands intended
6 # for further script processing (unrecognized by Pachi itself):
8 # pachi-mygame COLOR OPPONENT DATE TIME
9 # pachi-mymove COORD VALUE
11 # (You probably want to convert pachi-mymove to play.)
13 chomp;
15 # 19.1.2012 20:47:47 com.gokgs.client.gtp.a <init>
16 if (s/^(\S+ \S+) com.gokgs.client.gtp.a <init>$/$1/) {
17 $a = $1;
19 # FINE: Starting game as white against Mateman
20 } elsif (s/^FINE:.*as (\S+) against (\w+)/$1 $2/) {
21 print "pachi-mygame $_ $a";
23 # IN: play b o3
24 } elsif (s/^IN: // and not /genmove/ and not /kgs-chat/ and not /time/) {
25 print $_;
27 # *** WINNER is C4 (3,4) with score 0.4333 (49243/93153:93153/93393 games), extra komi 0.000000
28 } elsif (s/^\*\*\* WINNER is (\S+) .*score (\S+) .*komi 0\.0.*/$1 $2/) {
29 print "pachi-mymove $_";