1

I have started playing around with SCID and Arena to analyze my games and store interesting screenshots. I recently heard about the FEN notation which makes it convenient to describe chess positions (previously I used to store screenshots of the board positions)

Now I know that SCID can read a single FEN string and set up the described position from that string. As far as I understand, it cannot read a file containing multiple FEN positions, and iterate through them.

What I would like to do is keep a database text file with interesting positions from my games, or famous games, or typical opening positions into a single file, one FEN string per line, along with a short comment giving some more context and information about the position.

So the file would be something like

1b6/4pKn1/8/1nPkqp1R/2pr3p/3b1pp1/P3Qp2/2BRr3     # comment 1
1B6/4pKR1/3b3p/3QN2p/1Rb2k2/3PpN1P/2q1P3/8        # comment 2
1b6/4pN1K/2qpQ1p1/R4n1p/1Prkb3/N2p1pB1/3P1n1r/8   # comment 3
1B6/4pN1p/7p/3P1k2/2p5/4P2K/4P3/2Q4N              # comment 4

Can SCID handle such a file with multiple FEN notations? Or is there some other software for reading such files and allowing me to iterate through the various positions described in that file (and hopefully allowing me to make some edits)

4

A file that contains one FEN per line is a file format in itself. It's the file format used by test positions for chess engines. So engines definitely have some process to analyse all the positions in a FEN file.

(Ermm... your FEN is missing the king-castling, move number and who is to move indicator -- you'll want those.)

An alternative would be to convert each FEN line into a PGN game -- The FEN line goes in the PGN header, e.g. [FEN "1b6/4pKn1/8/1nPkqp1R/2pr3p/3b1pp1/P3Qp2/2BRr3"], and the comment can just be a "Before move annotation". So you could construct a minimal PGN game for each position -- and PGN is supported by absolutely every single piece of chess software out there. There is a minimal set of headers required for a valid PGN game, White, Black, Site, and Result. Plus that FEN header.

Scout around, maybe you can find a fen2pgn script. There was one a few decades ago.

1
1

You may want to consider the EPD format in order to append any kind of annotation, comment, information... to the "rigid part" of the FEN (which remains the same in EPD, except for the move counters). I read that EPD was officially integrated into PGN, and I know that one PGN file can hold several distinct games, so you should be able to incorporate the FENs into a PGN.

Also, Python now has a chess module (see the doc here) which can read (parse) and write (output) FEN, EPD and PGN and also SVG (high-resolution graphic rendering of chess positions). If you need automated processing of a database of FENs, that might be an interesting path: You can simply read in line by line your FEN's (like, FEN = input()), use B = chess.Board( FEN ) to parse it, then modify / extract whatever data you want, and write back the result in whatever format suits your needs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.