Answers.Body: <h1>Crafty</h1>
  
  <p><a href="http://www.craftychess.com/">Crafty</a> is a strong chess programm and can be used with Winboard, Xboard and Scid. So it is available for all major operating systems.</p>
  
  <h1>Scid</h1>
  
  <p><a href="http://scid.sf.net/">Scid</a> can maintain databases of chess games, you can analyse (end) games.The software is available for all major operating systems.</p>
  
  <h1>Xboard</h1>
  
  <p><a href="http://savannah.gnu.org/projects/xboard/">Xboard</a> is a user interface to the Internet Chess Server. It uses the X Windows System, so I assume this runs only under GNU/Linux. Xboard can be used as a viewer and supports all forms of chess.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2012-05-01T20:56:11.443Z
Answers.LastActivityDate: 2012-05-01T21:02:24.883Z
Answers.LastEditDate: 2012-05-01T21:02:24.883Z
Answers.UserDisplayName: qbi
Answers.Body: <h1><a href="http://pychess.org/">PyChess</a></h1>
  
  <p>Is a chess client built in Python. You can use it's chess logic libraries without much trouble.</p>
  
  <ul>
  <li><a href="http://code.google.com/p/pychess/source/browse/utilities/arena.py">http://code.google.com/p/pychess/source/browse/utilities/arena.py</a></li>
  <li><a href="http://code.google.com/p/pychess/source/browse/utilities/blunders.py">http://code.google.com/p/pychess/source/browse/utilities/blunders.py</a></li>
  </ul>
  
  <p>Are examples of how you you might use the libraries to control chess engines, but you can also use just the chess logic:</p>
  
  
  
  <pre><code>from pychess.Utils.Board import Board
  from pychess.Utils.lutils.lmove import toSAN
  from pychess.Utils.lutils.lmovegen import genAllMoves
  board = Board(setup=True).board
  for move in genAllMoves (board):
      print (toSAN (board, move)))
  </code></pre>
  
  <p>It's very fast, since it's used for the built in engine, and it has many advanced features such as parsing long list of SAN moves, generating check evasions and static exchange evaluation (SEE).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2013-02-08T18:41:14.473Z
Answers.Text: Thanks for sharing, looks very interesting. What does the above do? Could a similar snippet import a pgn file from disk and print all the moves in a similar loop? Does it have libraries to export html? Is there documentation that would help with doing similar kind of scripting?
Answers.UserDisplayName: Joe
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2013-02-08T18:43:39.183Z
Answers.Text: And checking out the link, it seems like the actual tool does not run on Windows - yet. Do you think the above code would run on Windows in headless mode though?
Answers.UserDisplayName: Joe
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2013-02-08T23:00:31.247Z
Answers.Text: The above code prints out all possible moves for white in the default position, using Standard Algebraic Notation. Parsing moves is also easy with the same couple of modules. If your project were GPL, I would just copy out the entire lutils module, which is pure Python and doesn't require any Linux specific process handling.
Answers.UserDisplayName: Thomas Ahle
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2013-02-08T18:18:22.250Z
Answers.LastActivityDate: 2013-02-08T18:18:22.250Z
Answers.UserDisplayName: Thomas Ahle
Answers.Body: <h1>Stockfish</h1>
  
  <p>Stockfish (<a href="http://www.stockfishchess.com/">website</a> and <a href="https://github.com/mcostalba/Stockfish">github</a>) is an open source and very strong <a href="http://en.wikipedia.org/wiki/Universal_Chess_Interface">UCI engine</a>. As such it can do all you are asking for, but usually requires a GUI in order to do so. You can however access all functionality via a command prompt/shell as well.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2012-05-01T22:02:49.020Z
Answers.LastActivityDate: 2012-05-01T22:02:49.020Z
Answers.UserDisplayName: Bryan
Body: <p>Is anyone familiar with any open source chess libraries in any language that can do any of the following:</p>
  
  <ul>
  <li>parse PGNs and/or FENs</li>
  <li>calculate valid chess moves based on position</li>
  <li>process an entire chess game</li>
  </ul>
  
  <p>EDIT:</p>
  
  <p>Sorry, I should be more clear. I'm not looking for open source software, I'm looking for open source programming libraries.</p>
  
Tags: <programming><open-source><pgn><fen>
Title: Open source chess playing or pgn viewing libraries
ThreadText: # Open source chess playing or pgn viewing libraries
  
  (Asked by: username_0 on 2012-05-01)
  
  Is anyone familiar with any open source chess libraries in any language that can do any of the following:
  
  * parse PGNs and/or FENs
  * calculate valid chess moves based on position
  * process an entire chess game
  
  EDIT:
  
  Sorry, I should be more clear. I'm not looking for open source software, I'm looking for open source programming libraries.
  
  **Tags:** programming, open-source, pgn, fen
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_4 on 2012-05-01. Score: 9 | Accepted answer
  
  # Stockfish
  
  Stockfish ([website](http://www.stockfishchess.com/) and [github](https://github.com/mcostalba/Stockfish)) is an open source and very strong [UCI engine](http://en.wikipedia.org/wiki/Universal_Chess_Interface). As such it can do all you are asking for, but usually requires a GUI in order to do so. You can however access all functionality via a command prompt/shell as well.
  
  
  ---
  
  ### Answer by username_1 on 2012-05-01. Score: 11
  
  # Crafty
  
  [Crafty](http://www.craftychess.com/) is a strong chess programm and can be used with Winboard, Xboard and Scid. So it is available for all major operating systems.
  
  # Scid
  
  [Scid](http://scid.sf.net/) can maintain databases of chess games, you can analyse (end) games.The software is available for all major operating systems.
  
  # Xboard
  
  [Xboard](http://savannah.gnu.org/projects/xboard/) is a user interface to the Internet Chess Server. It uses the X Windows System, so I assume this runs only under GNU/Linux. Xboard can be used as a viewer and supports all forms of chess.
  
  
  ---
  
  ### Answer by username_2 on 2013-02-08. Score: 10
  
  # [PyChess](http://pychess.org/)
  
  Is a chess client built in Python. You can use it's chess logic libraries without much trouble.
  
  * <http://code.google.com/p/pychess/source/browse/utilities/arena.py>
  * <http://code.google.com/p/pychess/source/browse/utilities/blunders.py>
  
  Are examples of how you you might use the libraries to control chess engines, but you can also use just the chess logic:
  
  ```
  from pychess.Utils.Board import Board
  from pychess.Utils.lutils.lmove import toSAN
  from pychess.Utils.lutils.lmovegen import genAllMoves
  board = Board(setup=True).board
  for move in genAllMoves (board):
      print (toSAN (board, move)))
  
  ```
  
  It's very fast, since it's used for the built in engine, and it has many advanced features such as parsing long list of SAN moves, generating check evasions and static exchange evaluation (SEE).
  
  > **Comments:**
  > **username_3**: Thanks for sharing, looks very interesting. What does the above do? Could a similar snippet import a pgn file from disk and print all the moves in a similar loop? Does it have libraries to export html? Is there documentation that would help with doing similar kind of scripting?  
  > **username_3**: And checking out the link, it seems like the actual tool does not run on Windows - yet. Do you think the above code would run on Windows in headless mode though?  
  > **username_2**: The above code prints out all possible moves for white in the default position, using Standard Algebraic Notation. Parsing moves is also easy with the same couple of modules. If your project were GPL, I would just copy out the entire lutils module, which is pure Python and doesn't require any Linux specific process handling.  
  
  ---
  
  