From 3fd43cd5fcb22bb65bf2a92a25d95d801b11c9e0 Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Wed, 1 Jun 2016 18:58:58 -0700 Subject: Initial checkin for typhoon chess engine. --- tests/convert_epd.pl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 tests/convert_epd.pl (limited to 'tests/convert_epd.pl') 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"; + } +} -- cgit v1.3