Annotate games

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Annotate games

Post by lucasart »

Are there any programs with an "annotate" function ? By that I mean you take a PGN, and test every move with a quick search (like 1 sec or so), and output annotations like: in this position (fen and board text display let's say) white played that move which is incorrect, better was that move. Also one may want to see there refutation, so you would display the PV line after the incorrect move is played.

It's particularly useful for me when I play games on internet. I may do mistakes that other noobs like me (1600 elo or so) do not see, but they're still mistakes. I just want to save the games and run an "annotate" to learn from my mistakes :)

I could code it in my own engine DoubleCheck, but I'm too lazy to write a PGN parser... :(

Anyway, for engine developpers, I think it's *really* a nice feature to have. Especially as there are so many strong engines out there, one may want to distinguish themselves by providing somewhat rare features (like this one, or the ability to play chess960 for example which is still not supported by many engines)
Last edited by lucasart on Sat Jan 21, 2012 5:04 am, edited 1 time in total.
CRoberson
Posts: 2056
Joined: Mon Mar 13, 2006 2:31 am
Location: North Carolina, USA

Re: Annotate games

Post by CRoberson »

Some UCI GUI's have that feature. ChessBase does, thus you can use any UCI engine to do it.
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Annotate games

Post by lucasart »

CRoberson wrote:Some UCI GUI's have that feature. ChessBase does, thus you can use any UCI engine to do it.
I'm a Linux user, so I don't use ChessBase. Are there any good and free Linux GUI that are UCI compatible and have this feature ?
But yes, in principle I agree that it should be a GUI feature, so engine developpers don't have to do all the work of parsing PGN etc.
CRoberson
Posts: 2056
Joined: Mon Mar 13, 2006 2:31 am
Location: North Carolina, USA

Re: Annotate games

Post by CRoberson »

Yes, I predominately use Linux too. Don't know if one exists or not. Shredder has a GUI for Linux. You can download a test version from shredderchess.com

Let me know if it has it. SCID exists for Linux as well, but haven't looked for an annotate feature.
UncombedCoconut
Posts: 319
Joined: Fri Dec 18, 2009 11:40 am
Location: Naperville, IL

Re: Annotate games

Post by UncombedCoconut »

SCID has an "annotate" button in its engine analysis window with a lot of flexibility.

PyChess has a very crude version of this, implemented as a script. It can analyze with any engine that PyChess itself can find. (See below.)

Crafty has an "annotate" command which is much better. It analyzes with Crafty, of course.

Here's a run of the PyChess blunder-check on a game from within its source tree. I don't think distros install this script anywhere, but I could be wrong. You can see that it's far from perfect, but not useless.

Code: Select all

[justinb@coconut ~]$ cd ~/code/pychess/
[justinb@coconut pychess]$ PYTHONPATH=lib/ ./utilities/blunders.py ~/Downloads/andriasian_litwiniec_2010.pgn 
Selected file /home/justinb/Downloads/andriasian_litwiniec_2010.pgn

The file contains the following games:
[0] Zaven Andriasian vs. Miroslawa Litwiniec

Autoselecting game 0.

PyChess found the following analyzers on your system:
[0] Stockfish 120118 64bit SSE4.2
[1] PyChess 0.10
[2] Critter 1.4 64-bit SSE4
[3] Toga II 1.3.1
[4] Komodo64 3 sse4.2
[5] Crafty-23.4

What engine should be your analyzer? [n] 0

Enter how many seconds we should use for each move [n]: 5

Stockfish 120118 64bit SSE4.2 will now analyze the game between Zaven Andriasian and Miroslawa Litwiniec with 5 seconds per move.

.....................
Considering 17 Rd8+  ................................
White blunder -1916
Should have done: Rd8+, Kxd8, Qxf7, Bh3, Qxg7, Re8, Rd1+, Kc8, gxh3, Kb8, Qg6, Rh8, Qxe4, Rc8, e6, a5, e7, Ka7, Bc5+, b6, Bxb6+, Kxb6, Rb1+, Kc5, Qe3+, Kc6, Qe6+, Kc5, Qd7, Rg8+, Kf1

Considering 17 Qxf7  ................................
Considering 16 Bxf7+  ..........................
Considering 16 Qf5  ..........................
Black blunder 711
Should have done: Nd6, Bxd6, cxd6, Bb5, O-O, Bxd7, Bxd7, Qxb7, Rfd8, exd6, Rab8, Qxa7, Ra8, Qc7, Rac8, Qb6, Rb8, Qd4, Ra8, Rd2, Ra4, c4, Rda8, Rb1, Rxa2, Rxa2

Considering 15 Rad1  .........................
Considering 15 Ne4  ..........................
Black blunder 220
Should have done: c5, Rad1, Qc7, Bxf7+, Qxf7, Rd8+, Kxd8, Qxf7, Nd7, Rd1, Re8, e6, Re7, Qf8+, Re8, e7+

Considering 14 dxe5  .........................
White blunder -148
Should have done: dxe5, c5, Rad1, O-O, Rxd7, Nxd7, Bxf7+, Rxf7, e6, Ne5, exf7+, Nxf7, Re1, Bg4, Re7, Rf8, Rxb7, Bh5, Qe6, Kh7, Bxc5, Rd8, Bd4, Rd6, Qb3, Kg8, Rxf7, Bxf7, Qb8+, Kh7

Considering 14 Nxe5  ...........................
Black blunder 235
Should have done: Na5, Qb1, Nxc4, Nxd7, Kxd7, Qb5+, Kd8, Qxc4, Be6, Qd3, Re8, Qg3, Ne4, Qxg7, Nxc3, Rfe1, a5, Qxh6, Kc8, Qc1, Nd5, Rb1, Ra6, Qc5, Rb6, Qxa5, Rxb1, Rxb1

Considering 13 Nxe5  ........................
Considering 13 Qd7  .............................
Black blunder 226
Should have done: Na5, Qa4+, Bd7, Qxa5, b6, Qa6, c5, Nxe5, O-O, Ng6, Qe4, Nxf8, Bc6, f3, Qe3+, Kh1, Rxf8, dxc5, Ra8, Rfd1, Qxc3, Rac1, Qe5, cxb6, axb6, Qxb6, Rxa3, Qxc6

Considering 12 Ba3  ........................
Considering 12 dxe5  .......................
Black blunder 368
Should have done: O-O, exf6, Qxf6, Bd3, Bg4, Nd2, Rab8, Ne4, Qg6, Qc2, Bf5, Nf6+, Qxf6, Bxf5, g6, Bd3, Rfe8, Rb1, Qh8, Bf4

Considering 11 e5  ........................
Considering 11 Nf6  .....................
Black blunder 239
Should have done: b6, Qd1, Na5, Bd3, Be6, Re1, O-O-O, Ba3, Bc4, e5, Qd7, Bb4, Bxd3, Qxd3

Considering 10 O-O  ...................
Considering 10 Qe7  .......................
Considering 9 bxc3  .....................
Considering 9 Bxc3+  ......................
Considering 8 Qb3  ....................
Considering 8 h6  .....................
Considering 7 Nc3  .....................
Considering 7 Bb4+  .....................
Considering 6 cxd4  ...................
Considering 6 exd4  ......................
Considering 5 d4  ....................
Considering 5 d6  ....................
Considering 4 c3  ....................
Considering 4 Bc5  .....................
Considering 3 Bc4  ......................
Considering 3 Nc6  .....................
Considering 2 Nf3  .....................
Considering 2 e5  ....................
Considering 1 e4  ..................... Finish
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Annotate games

Post by lucasart »

UncombedCoconut wrote:PyChess has a very crude version of this, implemented as a script. It can analyze with any engine that PyChess itself can find. (See below.)

Crafty has an "annotate" command which is much better. It analyzes with Crafty, of course.

Here's a run of the PyChess blunder-check on a game from within its source tree. I don't think distros install this script anywhere, but I could be wrong. You can see that it's far from perfect, but not useless.

Code: Select all

[justinb@coconut ~]$ cd ~/code/pychess/
[justinb@coconut pychess]$ PYTHONPATH=lib/ ./utilities/blunders.py ~/Downloads/andriasian_litwiniec_2010.pgn 
Selected file /home/justinb/Downloads/andriasian_litwiniec_2010.pgn

The file contains the following games:
[0] Zaven Andriasian vs. Miroslawa Litwiniec

Autoselecting game 0.

PyChess found the following analyzers on your system:
[0] Stockfish 120118 64bit SSE4.2
[1] PyChess 0.10
[2] Critter 1.4 64-bit SSE4
[3] Toga II 1.3.1
[4] Komodo64 3 sse4.2
[5] Crafty-23.4

What engine should be your analyzer? [n] 0

Enter how many seconds we should use for each move [n]: 5

Stockfish 120118 64bit SSE4.2 will now analyze the game between Zaven Andriasian and Miroslawa Litwiniec with 5 seconds per move.

.....................
Considering 17 Rd8+  ................................
White blunder -1916
Should have done: Rd8+, Kxd8, Qxf7, Bh3, Qxg7, Re8, Rd1+, Kc8, gxh3, Kb8, Qg6, Rh8, Qxe4, Rc8, e6, a5, e7, Ka7, Bc5+, b6, Bxb6+, Kxb6, Rb1+, Kc5, Qe3+, Kc6, Qe6+, Kc5, Qd7, Rg8+, Kf1

Considering 17 Qxf7  ................................
Considering 16 Bxf7+  ..........................
Considering 16 Qf5  ..........................
Black blunder 711
Should have done: Nd6, Bxd6, cxd6, Bb5, O-O, Bxd7, Bxd7, Qxb7, Rfd8, exd6, Rab8, Qxa7, Ra8, Qc7, Rac8, Qb6, Rb8, Qd4, Ra8, Rd2, Ra4, c4, Rda8, Rb1, Rxa2, Rxa2

Considering 15 Rad1  .........................
Considering 15 Ne4  ..........................
Black blunder 220
Should have done: c5, Rad1, Qc7, Bxf7+, Qxf7, Rd8+, Kxd8, Qxf7, Nd7, Rd1, Re8, e6, Re7, Qf8+, Re8, e7+

Considering 14 dxe5  .........................
White blunder -148
Should have done: dxe5, c5, Rad1, O-O, Rxd7, Nxd7, Bxf7+, Rxf7, e6, Ne5, exf7+, Nxf7, Re1, Bg4, Re7, Rf8, Rxb7, Bh5, Qe6, Kh7, Bxc5, Rd8, Bd4, Rd6, Qb3, Kg8, Rxf7, Bxf7, Qb8+, Kh7

Considering 14 Nxe5  ...........................
Black blunder 235
Should have done: Na5, Qb1, Nxc4, Nxd7, Kxd7, Qb5+, Kd8, Qxc4, Be6, Qd3, Re8, Qg3, Ne4, Qxg7, Nxc3, Rfe1, a5, Qxh6, Kc8, Qc1, Nd5, Rb1, Ra6, Qc5, Rb6, Qxa5, Rxb1, Rxb1

Considering 13 Nxe5  ........................
Considering 13 Qd7  .............................
Black blunder 226
Should have done: Na5, Qa4+, Bd7, Qxa5, b6, Qa6, c5, Nxe5, O-O, Ng6, Qe4, Nxf8, Bc6, f3, Qe3+, Kh1, Rxf8, dxc5, Ra8, Rfd1, Qxc3, Rac1, Qe5, cxb6, axb6, Qxb6, Rxa3, Qxc6

Considering 12 Ba3  ........................
Considering 12 dxe5  .......................
Black blunder 368
Should have done: O-O, exf6, Qxf6, Bd3, Bg4, Nd2, Rab8, Ne4, Qg6, Qc2, Bf5, Nf6+, Qxf6, Bxf5, g6, Bd3, Rfe8, Rb1, Qh8, Bf4

Considering 11 e5  ........................
Considering 11 Nf6  .....................
Black blunder 239
Should have done: b6, Qd1, Na5, Bd3, Be6, Re1, O-O-O, Ba3, Bc4, e5, Qd7, Bb4, Bxd3, Qxd3

Considering 10 O-O  ...................
Considering 10 Qe7  .......................
Considering 9 bxc3  .....................
Considering 9 Bxc3+  ......................
Considering 8 Qb3  ....................
Considering 8 h6  .....................
Considering 7 Nc3  .....................
Considering 7 Bb4+  .....................
Considering 6 cxd4  ...................
Considering 6 exd4  ......................
Considering 5 d4  ....................
Considering 5 d6  ....................
Considering 4 c3  ....................
Considering 4 Bc5  .....................
Considering 3 Bc4  ......................
Considering 3 Nc6  .....................
Considering 2 Nf3  .....................
Considering 2 e5  ....................
Considering 1 e4  ..................... Finish
I like Pychess, and it's really the best GUI I've found on Linux for playing online. SCID may have more features, but it's slow, and everything's so awckward, I just can't figure out how to use SCID...

The only rant I have with Pychess are:
* it's very complicated to add a new engine (you have to edit some illigible xml file, and it's really hard to get it right and impossible to debug if it doesn't work). I really hope they do an add engine feature in the GUI somewhere in the next version
* it crashes a lot, at least on Ubuntu.

I think I'll use Crafty for that. Do you know where I can find a good and easy to incorporate code for parsing PGN files in C ? Something short and simple, written in the most portable C style preferably. If I can get hold of such a code, I'll add it in my engine, and do my own annotate feature :D
UncombedCoconut
Posts: 319
Joined: Fri Dec 18, 2009 11:40 am
Location: Naperville, IL

Re: Annotate games

Post by UncombedCoconut »

I edited, adding a note about SCID anyway. :)
I actually find that SCID is awesome for analysis interactive analysis, especially if you already have a PGN of the game. I think Crafty's version is better for batch use, and PyChess's would be easier to modify for special purposes.

With PyChess it might help to try the latest development version. I've still seen it hang though. No idea about PGN parsers -- a few projects exist, but I haven't tried using any.
Ron Murawski
Posts: 397
Joined: Sun Oct 29, 2006 4:38 am
Location: Schenectady, NY

Re: Annotate games

Post by Ron Murawski »

lucasart wrote:Do you know where I can find a good and easy to incorporate code for parsing PGN files in C ? Something short and simple, written in the most portable C style preferably. If I can get hold of such a code, I'll add it in my engine, and do my own annotate feature :D
Steven J Edwards' SanKit seems to suit your requirements
http://horizonchess.com/Files/SanKit.zip
User avatar
hgm
Posts: 27809
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Annotate games

Post by hgm »

lucasart wrote:Are there any programs with an "annotate" function ? By that I mean you take a PGN, and test every move with a quick search (like 1 sec or so), and output annotations like: in this position (fen and board text display let's say) white played that move which is incorrect, better was that move. Also one may want to see there refutation, so you would display the PV line after the incorrect move is played.
XBoard has the 'Analyze Game' function (in older versions 'Analyze File', which takes the game from a file rather than using the already loaded one), which analyzes all positions of the game (by the auto-play time set in the Load Options dialog), and annotates it with score, depth and PV. You can then see the development of the score in the Evaluation Graph, and click on interesting score jumps to do more analysis there.

I did not build in any automatic 'blunder detection' filter. Usually the human eye is better at picking moves from the Eval Graph that deserve attention than any automatic filter.
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Annotate games

Post by Don »

lucasart wrote:
CRoberson wrote:Some UCI GUI's have that feature. ChessBase does, thus you can use any UCI engine to do it.
I'm a Linux user, so I don't use ChessBase. Are there any good and free Linux GUI that are UCI compatible and have this feature ?
But yes, in principle I agree that it should be a GUI feature, so engine developpers don't have to do all the work of parsing PGN etc.
I'm a linux developer too - I think I made a script that does such a thing. You provide a PGN file and finds moves that are not close in score to what it would play but it does not automatically conclude there is a problem, it will then check by searching deeper. It was my intention to flesh this out much more and have it identify great moves too and so on.

I will see if I can find that script someone, I may have lost it.

Don