4

Is there a way to read a PGN file using the Stockfish engine? If so, please give a sample command.

6
  • Especially the second answer probably answers your question as well. Feb 2, 2015 at 14:59
  • 1
    either you want to a) make stockfish start from a position in a pgn file b) make stockfish analyze a game from pgn file (you can do both with sw like arena or chessbase). Feb 9, 2015 at 17:28
  • Looks like we have some necromancy here, but if you're on Windows one good answer is to run SCID + Stockfish. SCID handles the input for you.
    – Tony Ennis
    Dec 30, 2015 at 4:07
  • I would recommend Arena Chess playwitharena.com By far, The best GUI I have come across to this day... Oct 18, 2016 at 5:27

4 Answers 4

6

Stockfish is an engine that's called by apps that read PGN files, it doesn't read the PGN data itself.

There are many very good free apps that can read PGN files and analyse the games they contain using Stockfish (which is also free) and/or similar engines (mostly not free)

A lot of good free PGN reader apps that are able to call Stockfish can be downloaded and installed from SourceForge, such as

ChessX An old app but a good one

Scid The most popular app on SourceForge at the time of writing

PGN ChessBook Which comes with the requested Stockfish engine built in

If you search for "pgn" on SourceForge you should find more apps, but in my opinion these are the best ones currently available.

5

The answer is NO. The stockfish engine does not have a concept of a chessboard state. Each position should be completely described through FEN notation. If you want to make a move, you then again describe the complete position and append your moves all in one command string then press ENTER on the keyboard. The engine does not remember the current position for you.

5

No. Stockfish is an engine not GUI, it doesn't know or understand PGN. The bigger problem is why would you do that? Why would you want to use an engine on a PGN game? This is like giving a calculator your math exam and hope it'll give out answers magically. Please rethink why you would want to do this.

0
3

You can use 2 programs to do that.

  1. Use pgn-extract to format the pgn files in a good format. This pgn-extract is available at this url: download pgn-extract
  2. You need this CLI tool: UCI analyzer
  3. Lastly, you need a chess engine that supports UCI installed, such as Stockfish.

I used these tools to perform a massive analysis of 2 million games on multiple machines.

1
  • Thank you for this Olivier!
    – hangejj
    Jan 9, 2022 at 4:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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