Page 1 of 1

some PGN2FEN help needed

PostPosted: 15 Jul 2007, 11:34
by GenoM
Hi
Is there any utility that makes fen files from the final positions of the games in pgn file?

I found Remi Coulom's and Tim Foden's but their programs seems to make fen-strings after each move of the pgn-games.

Regards,
Geno

Re: some PGN2FEN help needed

PostPosted: 15 Jul 2007, 11:50
by GenoM
Hi
I think I found the solution -- it seems pgn-extract can do this :)

Re: some PGN2FEN help needed

PostPosted: 16 Jul 2007, 14:07
by Norm Pollock
What are the pgn-extract parameters to do this?

Re: some PGN2FEN help needed

PostPosted: 17 Jul 2007, 01:10
by GenoM
Hi
This wasn't so easy I think :-)
The problem is that I made it but cannot remember exact steps.
To do this you has to make
At first:

pgn-extract -F Karpov.pgn >KarpovFEN.pgn

this makes a file with this output:
[Event "?"]
[Site "corres ARG"]
[Date "1960.??.??"]
[Round "?"]
[White "Karpov Anatoli"]
[Black "Dimnov"]
[Result "1-0"]
[ECO "C37"]

1. e4 e5 2. f4 exf4 3. Nf3 g5 4. Bc4 g4 5. O-O gxf3 6. Qxf3 Qf6 7. e5 Qxe5
8. d3 Bh6 9. Nc3 Ne7 10. Bd2 Nbc6 11. Rae1 Qf5 12. Nd5 Kd8 13. Qe2 Re8 14.
Bxf4 Bxf4 15. Rxf4 Qe6 16. Re4 Qd6 17. Qf2 f6 18. Qh4 Ne5 19. Nxf6 N5g6 20.
Qg5 Rf8 21. Nxh7 Rh8 22. Bf7 Rxh7 23. Rxe7 Qxh2+ 24. Kf2 c6 25. Re8+ Kc7
26. Qd8+ Kd6 27. R8e6+ Kc5 28. Qa5+ b5 29. d4+
{ "r1b5/p2p1B1r/2p1R1n1/Qpk5/3P4/8/PPP2KPq/4R3 b - - 0 29" } 1-0

You have to edit this file to replace all { in the beginning and all } in the end and add FEN to the beginning of FEN-strings. I made it in Wordpad.

Then from this place - http://www.avlerchess.com/chess-compute ... 00832.html
- i found this:
"Hi Jeff-

J.W. Cleveland did post this nifty DOS solution on "ccc"

Mike
==============================================================

If you are running windows, open a dos box, cd to the directory where your file
is, and type:
find "[FEN" myfile.pgn >fen.txt
where myfile.pgn is the name of the pgn file. This should put just the fen lines
in fen.txt. Load this file in a word processor, do 2 replace all to get rid of
the [FEN " and the "] save it as text and you should have it."

Of course you have to change "[FEN" to what is in your file.
That was all i think.

Regards,
Geno