Author: Matthew White
Date: 13:26:28 05/25/03
Go up one level in this thread
On May 25, 2003 at 14:44:03, Tim Foden wrote:
>On May 25, 2003 at 06:32:36, Uri Blass wrote:
>
>>Task number 1:Translate text files of lines in book for white and black
>>to an epd file of positions that are ordered in lexicographic order.
>>
>>The text files are books in frenzee format(for example this may be part of the
>>book for white):
>>
>>e2e4c7c5g1f3e7e6d2d4c5d4f3d4g8f6b1c3d7d6f1e2f8e7e1g1b8c6c1e3a7a6f2f4d8c7d1e1c8d7a1d1e8g8e1g3b7b5a2a3a8c8f4f5c6d4d1d4g8h8d4d2d7c6
>>e2e4c7c5g1f3e7e6d2d4c5d4f3d4g8f6b1c3d7d6f1e2f8e7e1g1b8c6c1e3a7a6f2f4d8c7d1e1c8d7a1d1e8g8e1g3c6d4e3d4d7c6e2d3f6h5g3h3e6e5c3d5c6d5e4d5e5d4h3h5g7g6h5f3e7f6
>>e2e4c7c5g1f3e7e6d2d4c5d4f3d4g8f6b1c3d7d6f1e2f8e7e1g1b8c6c1e3a7a6f2f4d8c7d1e1c6d4e3d4b7b5e1g3e8g8a2a3c8b7g1h1f8d8e2d3f6e8a1e1e7f8e4e5g7g6
>>e2e4c7c5g1f3e7e6d2d4c5d4f3d4g8f6b1c3d7d6f1e2f8e7e1g1b8c6c1e3a7a6f2f4d8c7d1e1c6d4e3d4b7b5e1g3e8g8e4e5d6e5f4e5e7c5d4c5c7c5g1h1f6d7a1e1b5b4c3e4c5e5e4f6g8h8g3h4d7f6e2f3e5b2f3a8c8d7
>>e2e4c7c5g1f3e7e6d2d4c5d4f3d4g8f6b1c3d7d6f1e2f8e7e1g1b8c6c1e3a7a6f2f4d8c7d1e1e8g8a1d1c6d4e3d4b7b5e4e5d6e5d4e5c7b6g1h1c8b7
>>e2e4c7c5g1f3e7e6d2d4c5d4f3d4g8f6b1c3d7d6f1e2f8e7e1g1b8c6c1e3a7a6f2f4d8c7e2f3c6a5d1e2a5c4e4e5d6e5d4b5a6b5c3b5c7b8e2c4e8g8f4e5b8e5e3d4
>>e2e4c7c5g1f3e7e6d2d4c5d4f3d4g8f6b1c3d7d6f1e2f8e7e1g1b8c6g1h1e8g8f2f4d8c7e2f3a7a6g2g4f8d8g4g5f6d7h2h4c6d4d1d4b7b5a2a4c8b7a4b5a6b5a1a8b7a8f3g2c7c5d4c5d7c5e4e5b5b4e5d6a8g2h1g2e7d6c3b5d6e7
>>e2e4c7c5g1f3e7e6d2d4c5d4f3d4g8f6b1c3d7d6f1e2f8e7e1g1b8c6g1h1e8g8f2f4d8c7d4b3a7a6a2a4c6a5b3a5c7a5d1e1a5c7e2f3c8d7c1e3g8h8e1f2d7c6
>
>I have a program (pgn2fen) that will convert a pgn file into either FEN or EPD
>format.
>
>======================================================================
>
>pgn2fen -- A utility to convert from PGN to a series of FEN/EPD lines
>Copyright (c) 2002 by Tim Foden; All rights reserved.
>Version 1.0.5. Compiled at 13:58:39 on 26 Apr 2002.
>
>Usage: pgn2fen <pgn-file-name> [-f|-e|-p] [-w|-b] [-v] [-l]
>
>Output format options:
> -f Outputs positions as FEN (this is the default)
> -e Outputs positions as EPD
> -p<P> Outputs only a board containing frequency counts
> <P> is a single black {pnbrqk} or white {PNBRQK} piece
>
>Output filter options:
> -w Only output positions with white to move
> -b Only output positions with black to move
> -min <ply> Minimum ply to include (1 based)
> -max <ply> Maximum ply to include (1 based)
> -res <value> Include only games matching result field
>
>Output tree options:
> -v Include variations in output (default is main line only)
> -l Include leaf nodes (no pm or bm in EPD)
>
>Miscellaneous options
> -s Only parse a single game from the pgn file
> -sc <dir> <exe> <scoreCmd> <scoreFmt>
> Use engine to get evaluation scores [EPD only]
>
>=====================================================================
>
>With a little bit of editing (possibly automatic) it could cope with your input
>above.
>
>For input it would need something like:
>
>[]
>e2e4 c7c5 g1f3 e7e6 d2d4 c5d4 f3d4 g8f6 b1c3 d7d6 f1e2 f8e7 e1g1 b8c6 c1e3 a7a6
>f2f4 d8c7 d1e1 c8d7 a1d1 e8g8 e1g3 b7b5 a2a3 a8c8 f4f5 c6d4 d1d4 g8h8 d4d2 d7c6
>
>[]
>e2e4 c7c5 g1f3 e7e6 d2d4 c5d4 f3d4 g8f6 b1c3 d7d6 f1e2 f8e7 e1g1 b8c6 c1e3 a7a6
>f2f4 d8c7 d1e1 c8d7 a1d1 e8g8 e1g3 c6d4 e3d4 d7c6 e2d3 f6h5 g3h3 e6e5 c3d5 c6d5
>e4d5 e5d4 h3h5 g7g6 h5f3 e7f6
>
>And can produce output like this:
>
>rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
>rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1
>rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2
>rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2
>rnbqkbnr/pp1p1ppp/4p3/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R w KQkq - 0 3
>rnbqkbnr/pp1p1ppp/4p3/2p5/3PP3/5N2/PPP2PPP/RNBQKB1R b KQkq - 0 3
>rnbqkbnr/pp1p1ppp/4p3/8/3pP3/5N2/PPP2PPP/RNBQKB1R w KQkq - 0 4
>...
>
>or like this:
>
>rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - fmvn 1; hmvc 0; pm e4;
>rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - fmvn 1; hmvc 0; pm c5;
>rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - fmvn 2; hmvc 0; pm Nf3;
>rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - fmvn 2; hmvc 1; pm
>e6;
>rnbqkbnr/pp1p1ppp/4p3/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R w KQkq - fmvn 3; hmvc 0; pm
>d4;
>rnbqkbnr/pp1p1ppp/4p3/2p5/3PP3/5N2/PPP2PPP/RNBQKB1R b KQkq - fmvn 3; hmvc 0; pm
>cxd4;
>rnbqkbnr/pp1p1ppp/4p3/8/3pP3/5N2/PPP2PPP/RNBQKB1R w KQkq - fmvn 4; hmvc 0; pm
>Nxd4;
>...
>
>which again should be fairly simple to massage into the form you want using unix
>command line tools (e.g. awk or sed).
>
>Cheers, Tim.
Here's a quick perl snippet that I wrote which cuts the original strings into
output readable by the pgn utilities:
open (IN, 'test.pgn');
while (<IN>) {
chomp;
print "[]\n";
$length = length($_);
for ($count=0; $count < $length / 4; $count +=4) {
$cutstr = substr $_, $count, 4;
print "$cutstr "
}
print "\n";
}
close(IN);
Regards,
Matt
>
>>
>>Task number 2:check if a position is in the book and return a move if it is in
>>the book:the check should also consider symmetric and in case that
>>
>>rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq -
>>is in book
>>
>>Then I want also the following position to be in book:
>>rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR b KQkq -
>>
>>I want the enpassent flag to be off unless enpassent capture is legal
>>
>>I hate programs for giving me after e4 e5 the following position:
>>rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq e6 0 2
>>
>>I think this stupid rule of FEN is only to confuse computers because there is no
>>difference between this position and the position without the e6 flag.
>>
>>Less important is to detect another kind of symmetry to detect that these 2
>>positions are the same(I could not find in a short time a practical example of
>>this kind of symmetry that can happen in normal games).
>>
>>rnbq1bnr/ppp2ppp/4k3/3pp3/3PP3/4K3/PPP2PPP/RNBQ1BNR w - -
>>rnb1qbnr/ppp2ppp/3k4/3pp3/3PP3/3K4/PPP2PPP/RNB1QBNR w - -
>>
>>Uri
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.