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

Re: Annotate games

Post by lucasart »

Don wrote:
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
Oh yes, that would be great. I suppose it's a Python script that would more or less work with any UCI engine ?

In fact, what would be mega awesome is to combine it with LaTeX!!

Just imagine...
* you have a PGN with the recent games you have played
* in a single command you send it in a script, it analyzes and finds mistakes
* it produces a .tex file, and sends it to LaTeX for compilation into a PDF file for example

So you end up with a report, with beautiful chess diagrams, and refutation lines written exactly like in a chess book...

:D
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Annotate games

Post by Don »

lucasart wrote:
Don wrote:
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
Oh yes, that would be great. I suppose it's a Python script that would more or less work with any UCI engine ?

In fact, what would be mega awesome is to combine it with LaTeX!!

Just imagine...
* you have a PGN with the recent games you have played
* in a single command you send it in a script, it analyzes and finds mistakes
* it produces a .tex file, and sends it to LaTeX for compilation into a PDF file for example

So you end up with a report, with beautiful chess diagrams, and refutation lines written exactly like in a chess book...

:D
That is exactly what I had in mind. However I do not use Latex and would have to take a few hours to learn enough to do this. What I had in mind was writing straight to PDF using one of the PDF libraries. I would have to figure that out too, I know how to write PDF but I don't know how to build diagrams with PDF.

I had in a mind an iterative process, getting such a system to work and then finding the glitches and annoyances and gradually improving it - with a heavy emphasis on this user friendly output - not just a dry scoring analysis showing what the computers move or score would be. In fact it would be minimalistic with respect to having computer scores and moves. As such my script (which I have not found yet) did not show blunders when one side was already winning unless it was a big blunder. Usually when one side is winning by a good margin you are not as critical of minor blunders.

Still, there is no way to do this as well as a human could do it - a human might be able to tell you what type of things to try for when you are down a piece for a pawn or two (for example) and unless you build in a bunch or rules of thumb you cannot get that part really working that well as you would probably mis-apply it too often.

I have gradually migrated from Perl to Ruby to Tcl over the years. Ruby is in the same class as Python and they are both the most fun to program in but I have tended towards Tcl primarily because of tclkit technology. It's completely trivial to produce standalone binaries for any platform with tclkit. That would not be enough by itself if tcl were not a superb language but it is more than adequate for almost anything and incredibly expressive. My CGOS server is written in tcl and just a few lines of code - all these great languages share this kind of expressiveness.

It it were only about the language itself, I would slightly favor Ruby or Python and then Perl.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Annotate games

Post by bob »

Don wrote:
lucasart wrote:
Don wrote:
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
Oh yes, that would be great. I suppose it's a Python script that would more or less work with any UCI engine ?

In fact, what would be mega awesome is to combine it with LaTeX!!

Just imagine...
* you have a PGN with the recent games you have played
* in a single command you send it in a script, it analyzes and finds mistakes
* it produces a .tex file, and sends it to LaTeX for compilation into a PDF file for example

So you end up with a report, with beautiful chess diagrams, and refutation lines written exactly like in a chess book...

:D
That is exactly what I had in mind. However I do not use Latex and would have to take a few hours to learn enough to do this. What I had in mind was writing straight to PDF using one of the PDF libraries. I would have to figure that out too, I know how to write PDF but I don't know how to build diagrams with PDF.

I had in a mind an iterative process, getting such a system to work and then finding the glitches and annoyances and gradually improving it - with a heavy emphasis on this user friendly output - not just a dry scoring analysis showing what the computers move or score would be. In fact it would be minimalistic with respect to having computer scores and moves. As such my script (which I have not found yet) did not show blunders when one side was already winning unless it was a big blunder. Usually when one side is winning by a good margin you are not as critical of minor blunders.

Still, there is no way to do this as well as a human could do it - a human might be able to tell you what type of things to try for when you are down a piece for a pawn or two (for example) and unless you build in a bunch or rules of thumb you cannot get that part really working that well as you would probably mis-apply it too often.

I have gradually migrated from Perl to Ruby to Tcl over the years. Ruby is in the same class as Python and they are both the most fun to program in but I have tended towards Tcl primarily because of tclkit technology. It's completely trivial to produce standalone binaries for any platform with tclkit. That would not be enough by itself if tcl were not a superb language but it is more than adequate for almost anything and incredibly expressive. My CGOS server is written in tcl and just a few lines of code - all these great languages share this kind of expressiveness.

It it were only about the language itself, I would slightly favor Ruby or Python and then Perl.
Crafty does this by the way. :)

Either html or latex output, your choice...

Been around for many years...
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Annotate games

Post by Don »

bob wrote: Crafty does this by the way. :)

Either html or latex output, your choice...

Been around for many years...
Hey, I could just cut and paste the code from Crafty and not even have to think about this!
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Annotate games

Post by bob »

Don wrote:
bob wrote: Crafty does this by the way. :)

Either html or latex output, your choice...

Been around for many years...
Hey, I could just cut and paste the code from Crafty and not even have to think about this!
Actually I would be totally agreeable. Not really "game playing code". :)
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Annotate games

Post by lucasart »

bob wrote:
Don wrote:
lucasart wrote:
Don wrote:
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
Oh yes, that would be great. I suppose it's a Python script that would more or less work with any UCI engine ?

In fact, what would be mega awesome is to combine it with LaTeX!!

Just imagine...
* you have a PGN with the recent games you have played
* in a single command you send it in a script, it analyzes and finds mistakes
* it produces a .tex file, and sends it to LaTeX for compilation into a PDF file for example

So you end up with a report, with beautiful chess diagrams, and refutation lines written exactly like in a chess book...

:D
That is exactly what I had in mind. However I do not use Latex and would have to take a few hours to learn enough to do this. What I had in mind was writing straight to PDF using one of the PDF libraries. I would have to figure that out too, I know how to write PDF but I don't know how to build diagrams with PDF.

I had in a mind an iterative process, getting such a system to work and then finding the glitches and annoyances and gradually improving it - with a heavy emphasis on this user friendly output - not just a dry scoring analysis showing what the computers move or score would be. In fact it would be minimalistic with respect to having computer scores and moves. As such my script (which I have not found yet) did not show blunders when one side was already winning unless it was a big blunder. Usually when one side is winning by a good margin you are not as critical of minor blunders.

Still, there is no way to do this as well as a human could do it - a human might be able to tell you what type of things to try for when you are down a piece for a pawn or two (for example) and unless you build in a bunch or rules of thumb you cannot get that part really working that well as you would probably mis-apply it too often.

I have gradually migrated from Perl to Ruby to Tcl over the years. Ruby is in the same class as Python and they are both the most fun to program in but I have tended towards Tcl primarily because of tclkit technology. It's completely trivial to produce standalone binaries for any platform with tclkit. That would not be enough by itself if tcl were not a superb language but it is more than adequate for almost anything and incredibly expressive. My CGOS server is written in tcl and just a few lines of code - all these great languages share this kind of expressiveness.

It it were only about the language itself, I would slightly favor Ruby or Python and then Perl.
Crafty does this by the way. :)

Either html or latex output, your choice...

Been around for many years...
Woaw, that's a pretty cool feature :D I'll sure use it to annotate my games.
Where can I find a page with explanation on the Crafty features ?

By the way, here's a game I recently played on FICS. It's not very good chess (both players ~ 1600 elo), so there might be quite a few imprecisions, and it was quite a wild game, so I would surely learn from look at an annotation report!

Code: Select all

[White "lucas"]
[Black "Maziyar"]
[Result "1-0"]

1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Bd7 5. Nc3 a6 6. a4 e6 7. Bc4 Nc6 8. Nxc6
Bxc6 9. O-O Rc8 10. Bb3 Be7 11. Qg4 Nf6 12. Qxg7 Rg8 13. Qh6 Nxe4 14. Nxe4 Bxe4
15. f3 Bxc2 16. Bxc2 Rxc2 17. Bd2 Qb6+ 18. Rf2 Qxb2 19. Rc1 Rxc1+ 20. Bxc1 Qb6
21. Qxh7 Rg6 22. Qh8+ Kd7 23. h4 Qc5 24. Bb2 Qc8 25. Qd4 Bf6 26. Qf4 e5 27.
Qf5+ Kd8 28. Qd3 Bxh4 29. Rc2 Qh3 30. Bxe5 Qe6 31. Re2 1-0 {Black forfeits on time}
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Annotate games

Post by lucasart »

Don wrote: That is exactly what I had in mind. However I do not use Latex and would have to take a few hours to learn enough to do this. What I had in mind was writing straight to PDF using one of the PDF libraries. I would have to figure that out too, I know how to write PDF but I don't know how to build diagrams with PDF.

I had in a mind an iterative process, getting such a system to work and then finding the glitches and annoyances and gradually improving it - with a heavy emphasis on this user friendly output - not just a dry scoring analysis showing what the computers move or score would be. In fact it would be minimalistic with respect to having computer scores and moves. As such my script (which I have not found yet) did not show blunders when one side was already winning unless it was a big blunder. Usually when one side is winning by a good margin you are not as critical of minor blunders.

Still, there is no way to do this as well as a human could do it - a human might be able to tell you what type of things to try for when you are down a piece for a pawn or two (for example) and unless you build in a bunch or rules of thumb you cannot get that part really working that well as you would probably mis-apply it too often.

I have gradually migrated from Perl to Ruby to Tcl over the years. Ruby is in the same class as Python and they are both the most fun to program in but I have tended towards Tcl primarily because of tclkit technology. It's completely trivial to produce standalone binaries for any platform with tclkit. That would not be enough by itself if tcl were not a superb language but it is more than adequate for almost anything and incredibly expressive. My CGOS server is written in tcl and just a few lines of code - all these great languages share this kind of expressiveness.

It it were only about the language itself, I would slightly favor Ruby or Python and then Perl.
You'd be reinventing the wheel there. LaTeX has some chess typesetting modules, that makes it really easy. Basically you input a fen position, and it displays a beautiful diagram, amongst other things.
Anyway, might be an idea to look at how Crafty does it before
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Annotate games

Post by lucasart »

lucasart wrote:
bob wrote:
Don wrote:
lucasart wrote:
Don wrote:
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
Oh yes, that would be great. I suppose it's a Python script that would more or less work with any UCI engine ?

In fact, what would be mega awesome is to combine it with LaTeX!!

Just imagine...
* you have a PGN with the recent games you have played
* in a single command you send it in a script, it analyzes and finds mistakes
* it produces a .tex file, and sends it to LaTeX for compilation into a PDF file for example

So you end up with a report, with beautiful chess diagrams, and refutation lines written exactly like in a chess book...

:D
That is exactly what I had in mind. However I do not use Latex and would have to take a few hours to learn enough to do this. What I had in mind was writing straight to PDF using one of the PDF libraries. I would have to figure that out too, I know how to write PDF but I don't know how to build diagrams with PDF.

I had in a mind an iterative process, getting such a system to work and then finding the glitches and annoyances and gradually improving it - with a heavy emphasis on this user friendly output - not just a dry scoring analysis showing what the computers move or score would be. In fact it would be minimalistic with respect to having computer scores and moves. As such my script (which I have not found yet) did not show blunders when one side was already winning unless it was a big blunder. Usually when one side is winning by a good margin you are not as critical of minor blunders.

Still, there is no way to do this as well as a human could do it - a human might be able to tell you what type of things to try for when you are down a piece for a pawn or two (for example) and unless you build in a bunch or rules of thumb you cannot get that part really working that well as you would probably mis-apply it too often.

I have gradually migrated from Perl to Ruby to Tcl over the years. Ruby is in the same class as Python and they are both the most fun to program in but I have tended towards Tcl primarily because of tclkit technology. It's completely trivial to produce standalone binaries for any platform with tclkit. That would not be enough by itself if tcl were not a superb language but it is more than adequate for almost anything and incredibly expressive. My CGOS server is written in tcl and just a few lines of code - all these great languages share this kind of expressiveness.

It it were only about the language itself, I would slightly favor Ruby or Python and then Perl.
Crafty does this by the way. :)

Either html or latex output, your choice...

Been around for many years...
Woaw, that's a pretty cool feature :D I'll sure use it to annotate my games.
Where can I find a page with explanation on the Crafty features ?

By the way, here's a game I recently played on FICS. It's not very good chess (both players ~ 1600 elo), so there might be quite a few imprecisions, and it was quite a wild game, so I would surely learn from look at an annotation report!

Code: Select all

[White "lucas"]
[Black "Maziyar"]
[Result "1-0"]

1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Bd7 5. Nc3 a6 6. a4 e6 7. Bc4 Nc6 8. Nxc6
Bxc6 9. O-O Rc8 10. Bb3 Be7 11. Qg4 Nf6 12. Qxg7 Rg8 13. Qh6 Nxe4 14. Nxe4 Bxe4
15. f3 Bxc2 16. Bxc2 Rxc2 17. Bd2 Qb6+ 18. Rf2 Qxb2 19. Rc1 Rxc1+ 20. Bxc1 Qb6
21. Qxh7 Rg6 22. Qh8+ Kd7 23. h4 Qc5 24. Bb2 Qc8 25. Qd4 Bf6 26. Qf4 e5 27.
Qf5+ Kd8 28. Qd3 Bxh4 29. Rc2 Qh3 30. Bxe5 Qe6 31. Re2 1-0 {Black forfeits on time}
Thanks Bob, that's really neat. I found the Crafty manual on your FTP. It's all pretty straightforward, and can be combined with shell scripts (i suppose it reads from stdin so I can pipe commands into crafty), which is great!

I'm look at the report now, and enjoying a free chess lesson by Master Crafty :D

Here's an example where the computer is actually teaching me something about strategy and positional play, despite the popular notion that computers are only good at tactics!
At move 15, I played f3, and Crafty prefers g3. It's interesting because g3 looks somewhat weakening, because of the light square diagonal. But after a little more think, one realizes that black will never have a chance to use this in anyway for the foreseeable future. g3 has the benefit of refuting the attack in a sustainable way, and allows the rook on f1 to move and go to d1 where it belongs to cramp black's developpement and pressure the black camp left with a king trapped in the center. So it's a good positional and strategic move this g3 :D
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Annotate games

Post by lucasart »

and I missed the tactical shot 30. Qxg6!
It's so obvious now that I look at it :oops:
Dave_N
Posts: 153
Joined: Fri Sep 30, 2011 7:48 am

Re: Annotate games

Post by Dave_N »

I was thinking Crafty could use the pawn structure score and the king safety score to explain more about a move (I don't know if this is already implemented). I was thinking about writing one of these programs myself based on interpreting engine output, however the positional points are unavailable without writing an evaluation term.