Answers.Body: <p>You may want to consider the <a href="https://en.wikipedia.org/wiki/Extended_Position_Description" rel="nofollow noreferrer">EPD format</a> in order to append any kind of annotation, comment, information... to the &quot;rigid part&quot; 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.</p>
  <p>Also, Python now has a <code>chess</code> module (<a href="https://python-chess.readthedocs.io" rel="nofollow noreferrer">see the doc here</a>) 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, <code>FEN = input()</code>), use <code>B = chess.Board( FEN )</code> to parse it, then modify / extract whatever data you want, and write back the result in whatever format suits your needs.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-16T03:57:56.660Z
Answers.LastActivityDate: 2021-12-16T03:57:56.660Z
Answers.UserDisplayName: Max
Answers.Body: <p>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.</p>
  <p>(Ermm... your FEN is missing the king-castling, move number and who is to move indicator -- you'll want those.)</p>
  <p>An alternative would be to convert each FEN line into a PGN game -- The FEN line goes in the PGN header, e.g. [FEN &quot;1b6/4pKn1/8/1nPkqp1R/2pr3p/3b1pp1/P3Qp2/2BRr3&quot;], and the comment can just be a &quot;Before move annotation&quot;. 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.</p>
  <p>Scout around, maybe you can find a fen2pgn script. There was one a few decades ago.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-14T11:57:53.460Z
Answers.Text: Thank you! I just discovered, that the xboard software (https://www.gnu.org/software/xboard/) does exactly what I want as mentioned in the question.
Answers.UserDisplayName: smilingbuddha
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-24T20:01:58.080Z
Answers.LastActivityDate: 2020-11-24T20:01:58.080Z
Answers.UserDisplayName: MikeD
Body: <p>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)</p>
  <p>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.</p>
  <p>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.</p>
  <p>So the file  would be something like</p>
  <pre><code>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
  </code></pre>
  <p>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)</p>
  
Tags: <fen>
Title: Software for reading multiple FEN positions
ThreadText: # Software for reading multiple FEN positions
  
  (Asked by: username_0 on 2020-11-24)
  
  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)
  
  **Tags:** fen
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2020-11-24. Score: 4 | Accepted answer
  
  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.
  
  > **Comments:**
  > **username_0**: Thank you! I just discovered, that the xboard software (https://www.gnu.org/software/xboard/) does exactly what I want as mentioned in the question.  
  
  ---
  
  ### Answer by username_1 on 2021-12-16. Score: 1
  
  You may want to consider the [EPD format](https://en.wikipedia.org/wiki/Extended_Position_Description) 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](https://python-chess.readthedocs.io)) 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.
  
  
  ---
  
  