2 # Convert ascii board diagrams from board_print() to t-unit board format.
3 # (remove borders and just keep the stones basically)
4 # Usage: ./board_print_to_tunit > foo.t
5 # copy paste the diagram, ^D
8 binmode STDIN
, ":utf8";
9 binmode STDOUT
, ":utf8";
12 foreach my $s (<STDIN
>)
15 # Remove current move mark
16 $s =~ s/([OX.])\)/$1 /;
17 if ($s =~ m/^ [ 1][0-9] \| (([.OX] )+)\|/ ||
18 $s =~ m/^[ 1][0-9] *(([.OX] )+) /)
23 $size = split("", $s) / 2;
24 print "boardsize $size\n";