diff options
Diffstat (limited to 'tests/convert_epd.pl')
| -rwxr-xr-x | tests/convert_epd.pl | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/convert_epd.pl b/tests/convert_epd.pl new file mode 100755 index 0000000..cdd774c --- /dev/null +++ b/tests/convert_epd.pl @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +# Yes, I never wrote real code to parse EPD files. This script converts +# "normal" style EPDs into what typhoon wants to eat. + +while(<>) { + @lines = split(/;/); + for $line(@lines) { + $id = $1 if ($line =~ /^\s*(id.*)$/); + if ($line =~ /^([pnbrqk\-\d\/]+\s[^b]+)bm\s([^;]+)/i) { + $fen = $1; + $solution = "solution $2"; + } elsif ($line =~ /^([pnbrqk\-\d\/]+\s[^b]+)am\s([^;]+)/i) { + $fen = $1; + $solution = "avoid $2"; + } + } + if ($#lines > 0) { + print "setboard $fen\n$id\n$solution\ngo\n"; + } +} |
