2 # pattern_bayes_gen: Generate pattern probability table from a SGF collection
4 (for i
in "$@"; do echo $i >&2; tools
/sgf2gtp.pl
<$i; done) |
5 .
/pachi
-d 0 -e patternscan competition |
7 BEGIN { use List::MoreUtils qw(uniq); }
11 my ($winner, $witness) = (/^\[(.*)\] \[(.*)\]$/);
13 sub parse { $_ = $_[0]; s/\) \(/),(/g; return split(/,/); }
15 for (uniq(parse($winner))) {
18 for (uniq(parse($witness))) {
24 $p{$_} = $choices{$_} / $counts{$_};
26 for (sort { $counts{$a} <=> $counts{$b} } keys %p) {
27 printf("%.3f %d %d %s\n", $p{$_}, $choices{$_}, $counts{$_}, $_);