I'd like to automatically generate move by move analysis (based on my past games) like they have on lichess for imported games. My guess is that I need to run a full stockfish analysis for each move (via UCI) and then glue those outputs together. I was just wondering if I was missing an easier way? Is there a "full" analysis option that let's you get all of the scoring/annotation in one go?
3 Answers
If you know a little python or shell programming you could try and use uci for each move and grab stockfish output, I will try and see if I can get this sorted at some point and share the code.
If just being offline is your concern, then try the stockfish app, there is offline analysis.
Again, from a programming angle, there is trying to add such a feature to scid.
Stockfish, like the UCI protocol in general, does not have a single "annotate all" command.
From your question, you seem not to be interested in a GUI option like Chessbase or Scid, but instead in how to create a program of your own.
I've found that the script posted here: https://github.com/rpdelaney/python-chess-annotator provides a good start at a model. It's written in Python, which has a great chess library.
There are few tricks it uses. It makes two passes: the first to identify key moves, and the second to focus on those. It works backwards so that it will already know the evaluation of the move actually played when it is calculating the optimal move. It doesn't spend time evaluating ECO positions.
I can't guarantee that this is the best approach, but it seems to work.
There are a few good approaches to your problem:
Upload your game to lichess, you'll get your computer analysis for free.
The software used to analyse games on lichess is fishnet, you may freely download it and try to figure out which parts can be used for your purpose.
CRAFTY -- this is well known chess engine, freely available everywhere, that can analyse your whole game. Once you have
crafty
started in the command line mode, just give it anannotate my_game.pgn wb 1-999 0.5 2 5
command, the parameters are:my_game.pgn -- your game file, "wb" -- if you want the analysis for White and/or Black, "1-999" -- the move range to analyse, "0.5" -- the score threshold, if the score change below that, the analysis is not printed -- this is used to make the engine to react to every small problem or to big blunders only, "2" is analysis time per move (in seconds), "5" -- the number of variations output.