PGN to fen

Sort:
JCapanegra

Hi,

I need to transform a file from PGN to fen but not just one game, I need to put a lot of fen one behind the other even from diferents games.

The program pgn2fen seems to do it.... but do not make the last move!!

Anyone knows another program that makes it?

Thanks!.

notmtwain
JCapanegra wrote:

Hi,

I need to transform a file from PGN to fen but not just one game, I need to put a lot of fen one behind the other even from diferents games.

The program pgn2fen seems to do it.... but do not make the last move!!

Anyone knows another program that makes it?

Thanks!.

So a 100 move game would have 200 fen positions. A 10 million game pgn database could become a 2 billion fen position database.

Why?  If you want to find transpositions in the opening, there must be easier ways to do it.

kco

I think Scid vs PC can find particular position from the games.

EscherehcsE

Well, I'm not sure what you're trying to do, but that bug in the Pgn2Fen program isn't good news. I don't know of any other program that does exactly what Pgn2Fen does.

Pgn-extract comes close, but it places a FEN after every move in the PGN file as a comment to the moves. So you have the FENs mingled with the game moves. (Use the --fencomments switch.)

Pgn-extract can also convert a PGN file to a list of epd positions, but the epd positions don't include the halfmove clock field or the fullmove number field. (And it adds a comment at the end of the epd position.) (Use the -Wepd switch.)

http://www.cs.kent.ac.uk/people/staff/djb/pgn-extract/

 

Rémi Coulom's Pgn2Epd converter can also convert to epd positions, but it has the same drawbacks as Pgn-extract.

http://remi.coulom.free.fr/

HGMuller

Indeed one wonders why this would ever be needed. It seems unlikely to be a goal in itself, so it must be a step on the way to a higher goal. And that higher goal might be achievable in infinitely more simple ways.

JCapanegra

Thanks for the answers guys!

I want to do some kind of stats about how often some relative positions between pieces appears in games.... so I need to read one position, actualize my stats; read another position; actualize my stats and so on.

I do not find a better way to do it than reading fen´s cause most of games data bases has games stored in PGN :-/

I´ll try those that make epd from PGN, not sure if epd´s are as usefull for me than fen´s but may be.

 

Note: I do not need to store millions of fens lines.

I could store, say, 10,000. Actulaize my stats with them.

Manually delete those 10,000 and load new 10,000 fen´s and so on.... what I can´t do it is store one fen, actualize my stats, delete this fen, read another single fen and so :-D

JCapanegra

Mmmm... fighting with no succes with pgn extract :-(

I could not amke ir read a single pgn :-O

it gives me "erros" always no matter I tried differents pgn´s.

JCapanegra

!! pgn2epd seems to do exactly what I need!

There is too little difference between read a fen and an epd like this gives me :-)

Thanks EscherehcsE!

JCapanegra

:-(  :-(

No, no.... it has the same issue than pgn2fen!!

or is a copy of pgn2fen or is a fen/epd rule I did not know.... to not explicit wrote the position after last move.

Here the last 3 epd lines from pgn2epd from some Adams vs Dickenson game :

6R1/2k5/4p1P1/2P2p2/8/4P1r1/3K4/8 w - - bm g7;

6R1/2k3P1/4p3/2P2p2/8/4P1r1/3K4/8 b - - bm Kb7;

6R1/1k4P1/4p3/2P2p2/8/4P1r1/3K4/8 w - - bm c6+;

Last move was 50.c6+  1-0 that means that was white pawn in c5 before last move.

Well see it here in the last to one epd line:

6R1/2k3P1/4p3/2P2p2/8/4P1r1/3K4/8 b - - bm Kb7;

and still there in the last line:

6R1/1k4P1/4p3/2P2p2/8/4P1r1/3K4/8 w - - bm c6+;

with just one black pawn in rank 6 in column d:

6R1/1k4P1/4p3/2P2p2/8/4P1r1/3K4/8 w - - bm c6+;

:-(


It seems I will make my self the last position in fen or epd :-/


 


JCapanegra

Well, at last! :-)....

pgn-extract-17-19 did the position after last move!!

Still fighting to cut the comments, but I improved my situation :-)

 

Note: I bet that pgn2epd directly copy pgn2fen code and add the necesary to transform it in epd ;-)

EscherehcsE
JCapanegra wrote:

Well, at last! :-)....

pgn-extract-17-19 did the position after last move!!

Still fighting to cut the comments, but I improved my situation :-)

 

Note: I bet that pgn2epd directly copy pgn2fen code and add the necesary to transform it in epd ;-)

You're right about Pgn2epd not creating the last position; I hadn't noticed that. Cry

It's good that you got pgn-extract working; I was just about to give you the exact command-line format.

If you're interested, Ferdinand Mosca has written a little GUI for pgn-extract. (Read the Help instructions - When you start up the GUI, you have to explicitely tell it where the pgn-extract executable is located.)

https://sites.google.com/site/deuteriumengine/files/10-pgn-extract-interface

JCapanegra

Thanks! I will try right now!

What I still can not do with pgn-stract is to quit the information (not comments, just the same information appears in PGN in the first 7 lines) that appears after each single epd line :-/

pgn2fen did not this.

JCapanegra

Nice GUI! :-)

JCapanegra

Are the information in epd after the "fen" part of the epd?

It is separated from the fen aprt by commas, so not easy to delete it to come back to just fen.

 

I think i must make a fix to pgn2fen :-/