Creating EPD from PGN leaf nodes

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

PaulieD
Posts: 240
Joined: Tue Jun 25, 2013 8:19 pm

Re: Creating EPD from PGN leaf nodes

Post by PaulieD »

Thanks Norm,

I just read the readme file in your excellent utility set and figured it out just as you answered. It works like a charm :D :

Thanks also to Dann Corbit and all the others who reached out to help !! :D :
Norm Pollock
Posts: 1077
Joined: Thu Mar 09, 2006 4:15 pm
Location: Long Island, NY, USA

Re: Creating EPD from PGN leaf nodes

Post by Norm Pollock »

PaulieD wrote:Thanks Norm,

I just read the readme file in your excellent utility set and figured it out just as you answered. It works like a charm :D :

Thanks also to Dann Corbit and all the others who reached out to help !! :D :
You can take it another step if you want to. "idOpcode" together with "epdInsert" in "40H-EPD" puts in line number opcodes for the epd records, and "gameNum" in "40H-PGN" puts in game number comments for the pgn games. Using both you can "connect" each epd record with its corresponding game.
PaulieD
Posts: 240
Joined: Tue Jun 25, 2013 8:19 pm

Re: Creating EPD from PGN leaf nodes

Post by PaulieD »

Norm Pollock wrote:
PaulieD wrote:Thanks Norm,

I just read the readme file in your excellent utility set and figured it out just as you answered. It works like a charm :D :

Thanks also to Dann Corbit and all the others who reached out to help !! :D :
You can take it another step if you want to. "idOpcode" together with "epdInsert" in "40H-EPD" puts in line number opcodes for the epd records, and "gameNum" in "40H-PGN" puts in game number comments for the pgn games. Using both you can "connect" each epd record with its corresponding game.
I am good the way it is Norm.
The power of those utilities is unrivaled in computerchess.
Kudos to you :)
Ferdy
Posts: 4849
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Creating EPD from PGN leaf nodes

Post by Ferdy »

PaulieD wrote:Looking to simply convert PGN to EPD, but it needs to be the ending pgn positions (leaf nodes) not every move like PGN Extract GUI does.

I have Python 3.4 installed and Ferdinand's PGN sorting tool. Can a simple bat file be creating to convert any pgn file to EPD with ending FEN? PGN Extract Gui does not allow switches to be added to the GUI commands.
Created a tool to output the last position of every game in a pgn file both in fen and epd format, the tool uses pgn2fen.exe program and a python script converted to exe file so that it is not necessary to install python.

To run double-click the PgnToEpdAndFenEndPosV1.exe file and be sure you have orig.pgn file, this is your source pgn file. Also the pgn2fen.exe (already included in the download file) is required.

Sample run:
That "Error loading PGN: Error: Line 88473:..." shown by pgn2fen, would mean that there is a blank line in the orig.pgn file at the end of file. That 88473 is the number of line in the pgn file. If the supplied pgn file has no blank line at the end, that error message will not appear. Anyway that error does not create problems in the extraction of the epd lines.

Code: Select all

orig.pgn file is found!!
pgn2fen.exe file is found!!


Converting pgn to epd using pgn2fen ...
Error loading PGN: Error: Line 88473: Unexpected End-of-file
elpased time: 31 sec

Saving end position of every game in epd and fen format ...
elpased time: 162 msec

done!!
Press enter key to exit
Sample epd output, added the id to easily track the epd line.

Code: Select all

5r2/8/P7/1P1k4/R7/2P5/K7/8 w - - fmvn 76; hmvc 1; id 1;
7R/8/8/8/8/8/2K1p3/4kr2 b - - fmvn 110; hmvc 3; id 2;
4k3/2r2pb1/pqN1p3/2R1P3/1P4p1/6P1/5P2/2Q3K1 w - - fmvn 47; hmvc 10; id 3;
8/3k4/2R5/p1Rp4/P3r3/5KP1/3r4/8 w - - fmvn 87; hmvc 15; id 4;
6R1/8/8/3P4/5p2/2K3k1/7p/6r1 b - - fmvn 81; hmvc 2; id 5;
Sample fen output:

Code: Select all

5r2/8/P7/1P1k4/R7/2P5/K7/8 w - - 1 76
7R/8/8/8/8/8/2K1p3/4kr2 b - - 3 110
4k3/2r2pb1/pqN1p3/2R1P3/1P4p1/6P1/5P2/2Q3K1 w - - 10 47
8/3k4/2R5/p1Rp4/P3r3/5KP1/3r4/8 w - - 15 87
6R1/8/8/3P4/5p2/2K3k1/7p/6r1 b - - 2 81
8/8/8/8/8/6k1/2r5/4K3 b - - 1 64
8/6pk/2Q2p1p/p4P2/P5PP/5PK1/8/4q3 w - - 9 54
Output file:

Code: Select all

end_pos.epd
end_pos.fen
Other story, the advantage of the fen format is that it has the fifty move counter. This is also the required format in uci protocol. At present Cutechess-cli will not read the fifty move counter since it only supported epd format.
LB and winboard will read the fen format. To use epd file in LB, you may rename the end_pos.fen to end_pos_fen.epd.

Download:
http://www.mediafire.com/download/4so08 ... dPosV1.rar
PaulieD
Posts: 240
Joined: Tue Jun 25, 2013 8:19 pm

Re: Creating EPD from PGN leaf nodes

Post by PaulieD »

Ferdy wrote:
PaulieD wrote:Looking to simply convert PGN to EPD, but it needs to be the ending pgn positions (leaf nodes) not every move like PGN Extract GUI does.

I have Python 3.4 installed and Ferdinand's PGN sorting tool. Can a simple bat file be creating to convert any pgn file to EPD with ending FEN? PGN Extract Gui does not allow switches to be added to the GUI commands.
Created a tool to output the last position of every game in a pgn file both in fen and epd format, the tool uses pgn2fen.exe program and a python script converted to exe file so that it is not necessary to install python.

To run double-click the PgnToEpdAndFenEndPosV1.exe file and be sure you have orig.pgn file, this is your source pgn file. Also the pgn2fen.exe (already included in the download file) is required.

Sample run:
That "Error loading PGN: Error: Line 88473:..." shown by pgn2fen, would mean that there is a blank line in the orig.pgn file at the end of file. That 88473 is the number of line in the pgn file. If the supplied pgn file has no blank line at the end, that error message will not appear. Anyway that error does not create problems in the extraction of the epd lines.

Code: Select all

orig.pgn file is found!!
pgn2fen.exe file is found!!


Converting pgn to epd using pgn2fen ...
Error loading PGN: Error: Line 88473: Unexpected End-of-file
elpased time: 31 sec

Saving end position of every game in epd and fen format ...
elpased time: 162 msec

done!!
Press enter key to exit
Sample epd output, added the id to easily track the epd line.

Code: Select all

5r2/8/P7/1P1k4/R7/2P5/K7/8 w - - fmvn 76; hmvc 1; id 1;
7R/8/8/8/8/8/2K1p3/4kr2 b - - fmvn 110; hmvc 3; id 2;
4k3/2r2pb1/pqN1p3/2R1P3/1P4p1/6P1/5P2/2Q3K1 w - - fmvn 47; hmvc 10; id 3;
8/3k4/2R5/p1Rp4/P3r3/5KP1/3r4/8 w - - fmvn 87; hmvc 15; id 4;
6R1/8/8/3P4/5p2/2K3k1/7p/6r1 b - - fmvn 81; hmvc 2; id 5;
Sample fen output:

Code: Select all

5r2/8/P7/1P1k4/R7/2P5/K7/8 w - - 1 76
7R/8/8/8/8/8/2K1p3/4kr2 b - - 3 110
4k3/2r2pb1/pqN1p3/2R1P3/1P4p1/6P1/5P2/2Q3K1 w - - 10 47
8/3k4/2R5/p1Rp4/P3r3/5KP1/3r4/8 w - - 15 87
6R1/8/8/3P4/5p2/2K3k1/7p/6r1 b - - 2 81
8/8/8/8/8/6k1/2r5/4K3 b - - 1 64
8/6pk/2Q2p1p/p4P2/P5PP/5PK1/8/4q3 w - - 9 54
Output file:

Code: Select all

end_pos.epd
end_pos.fen
Other story, the advantage of the fen format is that it has the fifty move counter. This is also the required format in uci protocol. At present Cutechess-cli will not read the fifty move counter since it only supported epd format.
LB and winboard will read the fen format. To use epd file in LB, you may rename the end_pos.fen to end_pos_fen.epd.

Download:
http://www.mediafire.com/download/4so08 ... dPosV1.rar
Ferdinand,

This tool works great also. One simple click.

People can say what they want about the bickering and flaming on this forum, but there is no better place to get help when you need it from some of the most knowledgeable computerchess people in the world.

Thank you :)
jefk
Posts: 1025
Joined: Sun Jul 25, 2010 10:07 pm
Location: the Netherlands
Full name: Jef Kaan

Re: Creating EPD from PGN leaf nodes

Post by jefk »

[quote="PaulieD"]
This tool works great also. One simple click.
[/quote]

another tool is the older version of Bookbuilder (3.6)
which works under windows, not simply Dos.
Butit only exports Epd, not Fen. On the other hand it has some
other goodies as well, which you might be interested in later,
depending on your purposes
http://home.kpn.nl/jefkaan/DreamHC/bb36.zip

jef