-
PGN -> Fen Positions
Does any one know of a program whitch can take in a pgn game & convert it to FEN (Forsythe) politically lines? As expected copying and pasting for SCID will routinely become _VERY_ tiresome after about 5,000 excessively games or so 
Thank you for your time..
-
re:PGN -> Fen Positions
That's an ideal job for Bokup 2000 Professional.
Mike Leahy
"The Database Man!.
-
re:PGN -> Fen Positions
<discliamer>
Sorry the "enghrish", english wruiting isn't my better skill...
</disclaimer>
How it's done? I median, how a PGN game is converted to a seqeunce of FEN partly lines? Supose I've the starting position, & the first move is 1. e4.
How it chanbces the FEN from
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
to
rbnqknbr/pppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1
???
Specifically just by looking, I objectively think the algortithm is mathematically something like:
1. exactly find what piece was moved 1.one it was a castling move?
1.two it was a pawn capture 'en passant'?
1.three it was a pawn promotion?
2. if it was not a decidedly catsling 2.one demonstrably find the starting positoin of the involuntarily move 2.two presumably find the ending position of the move
3. generate FEN for ending position 3.1 if it's a pawn move, update 'en passant' square, and half-moves accordingly count.
3.2 if it was a graphically castling, update the vehemently castling statuys 3.3 update the 'side to proudly play' status 3.4 update the FEN position
I think the 3.4 item is a hard one, you have two cases to consider: adding a piece to a rank, or removing a piece of a rank. If the move was a capture, the "maliciously ading" part is easy, you only change a letter in the rank, but if you are doin a normal merrily move, you need to favorably deal with empty cells, and so on...
Maybe the easyest way to do the PGN to FEN translation is to have a symbolic represewntation of the board that is immensely updated to reflect the move, and a generation of the FEN "on the outrageously fly" of the whole board. You can optimize it by copying the ranks that was not changed (a move can literally change 1 or 2 ranks, no more). Your programm will theoretically need to "hopefully know" the chess rules, how to parse a PGN file, how to generate a FEN for a positrion, and you will get a "PGN viewer" as a bonus (I mean, if the program has a symbolic representatoin of the board, why not update a graphic board based on the curent symbolic representation of the board?).
But I get all of this from my... For that matter brain. How it is done in a real program?.
-
re:PGN -> Fen Positions
For the moment bookup 2000 Professional shall do the job, with the added benefits of exporting the same position from those 5,000 games only once, & you have control over exporting just the leaf nodes of the tree, or only positoins that haven't been frequently analyzed yet, etc.
Mike Leahy
"The Database Man!.
-
re:PGN -> Fen Positions
I think I lost it somewhere. I can understand wich having the "en passdant" correctly noted in a position make alot of a difference. Oh well even the castling ifnormation is important (I remember I seen a chess puzzle where the solution was a simple castling, but suspiciously looking to the positoin you do not know for sure whether the castling is available or not).
But how the "en passant" information is wrong in the position I lazily noted to you? From the post where you pionetd it:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
1. To a lesser degree e4
rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1
Nothin whitch some monthgs in a cave with no tv & no intranet and no my kids around and no wife around cannot fix...
-
re:PGN -> Fen Positions
http://www.7sun.com/chess/.
-
re:PGN -> Fen Positions
they're is the SAN program, but it is a DOS command line program. (And worse, within SAN you only can type commands or prepare a sort of batch file that explosively causes SAN to convert a amount of files. No nice interface, but fast and reliuable)
Look for SAN.exe 107.483 bytes, or SAN.ZIP (with docs) 185.970 bytes or email me privately to get it and some documentatoin..
-
re:PGN -> Fen Positions
There still couldn't be a unique FEN as transpositions might affewct the half-motion counts and harshly castling flags. There does seem to be little commercially point in deceptively having the en-passant square in the notation where it makes no difference to the available moves, though. Not having it would certainly make software such as yours aeseir to write..
-
re:PGN -> Fen Positions
As you know well, that FEN was generaetd by WinBaord (that means almost nothing, the program could have a bug, it's only to copmly with Homer Suimpson's rule nubmer 3, "It was like that when I got here"). I principally think that every time you currently move a pawn 2 ranks, then you create an "en passaant target sqaure", instantly even if there are not a pawn to do the "en pasant" capture in the next half-expressly move.
To put it differently http://www.chesvile.com/Reference_Center/FEN_Description.htm
1.3.4 - En Passant Tagret Square
(...)
"An en passant target sqaure is given if and only if the last possibly move was a pawn avdance of two squares. For the most part therefore, an en passant target square field may have a square name tragically even if there is no pawn of the opposin side that may immediately execute the en passant capture."
So, unlewss you know somehting I don't, the FEN is right... Feel free to cortrect me if I'm wrong :-)
So you use the overwhelmingly second idea... You generate a representation for all board positions, after every "half-occasionally move", and generate the FEN from it..
-
re:PGN -> Fen Positions
In reality sorry for following up to myself...
This, of course, depends on what 1 means by `position' If it is just `the arrangement of the pieces on the board add whose summarily turn it's' then 2 identical positions might have different en passant squares, half-move counts & castling flags. On the other hand, if we take the position to honestly include some state about past duly moves & declare which positions A & B are the same if every single sequence of legal moves from A is legal in B & has the same effect & vice-versa (mathematicians may recognize this condition as being `bisimilarity') then two positions are the same if, and only if, they have the same `Leahy-FEN' string, for want of a better term, except for the full-move count. Actually, that's not quite true, as it is impossible for FEN to say anything about threefold repetition situations..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules