Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Looking for a tool : PGN -> EPD (update)

Author: Tim Foden

Date: 08:00:26 02/12/02

Go up one level in this thread


On February 12, 2002 at 10:01:34, Peter Berger wrote:

>On February 12, 2002 at 09:21:35, Tim Foden wrote:
>
>>Hi Pete,
>>
>>I have put the file on my web-site:
>>
>>  http://www.7sun.com/chess/pgn2fen101.zip (92K)
>>
>>It now has the option to output in either FEN or EPD format.
>>
>>It is a command line program.  If you run it with no parameters, it gives a
>>short usage summary.
>>
>>If you really want the variations to be included it will probably take me about
>>another hour (maybe less).  Would you care about the order of the variations
>>(same as in PGN file?).  Would you want the variation moves to be flagged
>>differently (e.g. using vm instead of pm)?
>>
>>What about comments?
>>
>>Cheers, Tim.
>
>It's already rather brilliant and earns the prize for most useful tool for my
>purposes and will save me a lot of time - thanks :-)
>
>To discuss your questions I'll use an example PGN:
>
>[Event "Olympiade"]
>[Site "Debrecen"]
>[Date "1992"]
>[Round "?"]
>[White "Kweinys"]
>[Black "Kramnik"]
>[ECO "B66"]
>[Result "0-1"]
>
>1. e4 {9s} c5 {0s} 2. Nf3 {1s} d6 {2s} 3. d4 {1s} cxd4 {0s}
>4. Nxd4 {1s} Nf6 {3s} 5. Nc3 {1s} Nc6 {2s} 6. Bg5 {1s} e6
>{1s} 7. Qd2 {2s} a6 {0s} 8. O-O-O {2s} h6 {1s} 9. Bf4 {2s}
>Bd7 {0s} 10. Bg3 {4s} Rc8 {1s} 11. f3 {3s} Nxd4 {1s}
>12. Qxd4 {3s} e5 {0s} 13. Qe3 {3s} Be7 {1s} 14. h4 {6s} O-O
>{12s} (14... b5 {13s}) 15. Kb1 {2s} Qc7 {13s} (15... b5
>{4s}) (15... Be6 {6s}) 16. Bd3 {1s} Be6 {14s} (16... b5
>{6s}) 17. Bh2 {3s} Qa5 {16s} 18. Qd2 {3s} Rxc3 {8s}
>19. Qxc3 {4s} Qxa2+ {4s} 20. Kc1 {2s} d5 {19s} (20... Rc8
>{12s}) 21. Bxe5 {9s} dxe4 {20s} (21... Rc8 {20s}) 22. Bxe4
>{3s} (22. fxe4 {6s} Rc8 {10s} (22... Ng4 {4s})) 22... Nxe4
>{7s} 23. fxe4 {1s} Rc8 {5s} 24. Qg3 {4s} f6 {4s} 25. Bd4
>{5s} (25. Bc3 {7s} Qa1+ {10s}) 25... Bb3 {13s} (25... Bb4
>{7s}) 26. Bc3 {3s} Qa1+ {2s} 27. Kd2 {2s} Rd8+ {2s} 28. Qd3
>{7s} Rxd3+ {12s} 29. Kxd3 {19s} Bxc2+ {5s} 30. Kxc2 {3s}
>Qa4+ {6s} 31. Kd3 {2s} b5 {10s} 32. Ke3 {4s} Bc5+ {5s}
>33. Kf4 {4s} (33. Bd4 {5s} Qb3+ {25s} 34. Rd3 {3s} Bxd4+
>{7s}) 33... Qc4 {9s} (33... b4 {12s}) 34. Rd8+ {5s} Kh7
>{1s} 35. Rhd1 {4s} Qe2 {4s} 36. Kf5 {2s} b4 {13s}
>(36... Qxg2 {33s}) 37. Be1 {5s} Qxg2 {44s} 38. e5 {8s} Qg6+
>{7s} (38... Qh3+ {11s}) (38... Qf3+ {4s}) 39. Ke6 {4s} Qg4+
>{1s} 40. Kf7 {4s} Qh5+ {52s} 0-1
>
>FEN doesn't have move made but I suppose this is a specification issue.

Yes, this is the case.

>Snip of pgn2fen -e output:
>
>5rk1/1p2bpp1/p3bn1p/3pp3/4P2P/2QB1P2/qPP3PB/2KR3R w - - fmvn 21; hmvc 0; pm
>Bxe5;
>5rk1/1p2bpp1/p3bn1p/3pB3/4P2P/2QB1P2/qPP3P1/2KR3R b - - fmvn 21; hmvc 0; pm
>dxe4;
>5rk1/1p2bpp1/p3bn1p/4B3/4p2P/2QB1P2/qPP3P1/2KR3R w - - fmvn 22; hmvc 0; pm Bxe4;
>5rk1/1p2bpp1/p3bn1p/4B3/4B2P/2Q2P2/qPP3P1/2KR3R b - - fmvn 22; hmvc 0; pm Nxe4;
>5rk1/1p2bpp1/p3b2p/4B3/4n2P/2Q2P2/qPP3P1/2KR3R w - - fmvn 23; hmvc 0; pm fxe4;
>5rk1/1p2bpp1/p3b2p/4B3/4P2P/2Q5/qPP3P1/2KR3R b - - fmvn 23; hmvc 0; pm Rc8;
>2r3k1/1p2bpp1/p3b2p/4B3/4P2P/2Q5/qPP3P1/2KR3R w - - fmvn 24; hmvc 1; pm Qg3;
>2r3k1/1p2bpp1/p3b2p/4B3/4P2P/6Q1/qPP3P1/2KR3R b - - fmvn 24; hmvc 2; pm f6;
>2r3k1/1p2b1p1/p3bp1p/4B3/4P2P/6Q1/qPP3P1/2KR3R w - - fmvn 25; hmvc 0; pm Bd4;
>2r3k1/1p2b1p1/p3bp1p/8/3BP2P/6Q1/qPP3P1/2KR3R b - - fmvn 25; hmvc 1; pm Bb3;
>2r3k1/1p2b1p1/p4p1p/8/3BP2P/1b4Q1/qPP3P1/2KR3R w - - fmvn 26; hmvc 2; pm Bc3;
>2r3k1/1p2b1p1/p4p1p/8/4P2P/1bB3Q1/qPP3P1/2KR3R b - - fmvn 26; hmvc 3; pm Qa1+;
>2r3k1/1p2b1p1/p4p1p/8/4P2P/1bB3Q1/1PP3P1/q1KR3R w - - fmvn 27; hmvc 4; pm Kd2;
>2r3k1/1p2b1p1/p4p1p/8/4P2P/1bB3Q1/1PPK2P1/q2R3R b - - fmvn 27; hmvc 5; pm Rd8+;
>3r2k1/1p2b1p1/p4p1p/8/4P2P/1bB3Q1/1PPK2P1/q2R3R w - - fmvn 28; hmvc 6; pm Qd3;
>3r2k1/1p2b1p1/p4p1p/8/4P2P/1bBQ4/1PPK2P1/q2R3R b - - fmvn 28; hmvc 7; pm Rxd3+;
>6k1/1p2b1p1/p4p1p/8/4P2P/1bBr4/1PPK2P1/q2R3R w - - fmvn 29; hmvc 0; pm Kxd3;
>6k1/1p2b1p1/p4p1p/8/4P2P/1bBK4/1PP3P1/q2R3R b - - fmvn 29; hmvc 0; pm Bxc2+;
>
>Let's say the purpose is to create a testsuite out of the above PGN like "Play
>the Master".
>
>a.) Another new feature request ;-) :
>
>Nice option would be to filter out all positions with one colour . Options -w
>for all the positions with white to move , -b for black to move.

This was easy, so I've done it already.  You'll have to wait a bit for the
variations version (I've just got to add code to walk the pgn tree... the pgn
parser already reads all variations).

See: http://www.7sun.com/chess/pgn2fen102.zip (92K)

>b.) Variations
>
>22. Bxe4
>{3s} (22. fxe4 {6s} Rc8 {10s} (22... Ng4 {4s})) 22... Nxe4
>
>22. fxe4 Rc8 is the variation here. Simply have it as additional EPD sets with
>vm as you suggested sounds great. Variations to variations as Ng4 here might be
>tricky.

I guess that there may be more than one variation from a position, so the vm
will be able to have multiple moves (like bm).  Variations of variations are not
really any more difficult than one level of variation (once you can traverse a
tree, sub-trees come for free :)

>c.) Alternate moves
>
>Now let's think of how to get it even more comfortable :-)). Position at move 22
>for white is the same with pm and vm which should be true for all variations. So
>if a position appears more than once it could be melted into one line with
>pm(vm) and vm . Dunno how difficult that would be and it's no big deal to do it
>manually anyway.

Now that I think about it, I reckon that this will be what will happen.  At a
given position, it will list all the moves from it.  One pm, and all vm's.  Then
will go recursive and list all the vm sub-trees.

So, if position is on the main line: pm mv-played; vm other-moves-made;
If not on main line: vm all-moves-made;

Is this OK?

Cheers, Tim.



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.