diff options
| author | Scott Gasch <[email protected]> | 2016-06-01 18:58:58 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2016-06-01 18:58:58 -0700 |
| commit | 3fd43cd5fcb22bb65bf2a92a25d95d801b11c9e0 (patch) | |
| tree | 9b6443235d16ba17f094a1a1c7ae53d2bcb9267b /tests/convert_epd.pl | |
Initial checkin for typhoon chess engine.
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"; + } +} |
