blob: cdd774c0caccbf542246dd11cf17be5fabd09a01 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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";
}
}
|