is there an annotation tool for UCI (like crafty annotate)?

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

casaschi
Posts: 164
Joined: Wed Dec 23, 2009 1:57 pm

Re: is there an annotation tool for UCI (like crafty annotat

Post by casaschi »

shiv wrote: As UCI aims to give more power to the GUI, command line auto-annotation is likely to be philosophically against UCI (though it can be done).
I dont understand your philosophy issue :-)

What would be the problem with a script that takes a polyglot style ini file for the engine configuration and then:
1- reads a game from a given PGN file
2- evaluates current position and best move/mainline
3- evaluates move played in the games
4- compares best move score with played move score and if the difference is larger than a given threshold adds an annotation
5- repeats from 2 until game is over

You can annotate the game backwards if better for the engine (if the engine keeps the hash tables from one iteration to the other).

What's philosophically wrong with the above (besides being to complex for myself to do)???

:?:
govert
Posts: 270
Joined: Thu Jan 15, 2009 12:52 pm

Re: is there an annotation tool for UCI (like crafty annotat

Post by govert »

casaschi wrote:
shiv wrote: As UCI aims to give more power to the GUI, command line auto-annotation is likely to be philosophically against UCI (though it can be done).
I dont understand your philosophy issue :-)

What would be the problem with a script that takes a polyglot style ini file for the engine configuration and then:
1- reads a game from a given PGN file
2- evaluates current position and best move/mainline
3- evaluates move played in the games
4- compares best move score with played move score and if the difference is larger than a given threshold adds an annotation
5- repeats from 2 until game is over

You can annotate the game backwards if better for the engine (if the engine keeps the hash tables from one iteration to the other).

What's philosophically wrong with the above (besides being to complex for myself to do)???

:?:
Nothing. I think we just didn't really grasp your idea - a standalone script communicating with the engine. He probably thought you were asking about UCI engines having this ability built in.
shiv
Posts: 351
Joined: Sat Apr 01, 2006 2:03 am

Re: is there an annotation tool for UCI (like crafty annotat

Post by shiv »

casaschi wrote:
shiv wrote: As UCI aims to give more power to the GUI, command line auto-annotation is likely to be philosophically against UCI (though it can be done).
I dont understand your philosophy issue :-)

What would be the problem with a script that takes a polyglot style ini file for the engine configuration and then:
1- reads a game from a given PGN file
2- evaluates current position and best move/mainline
3- evaluates move played in the games
4- compares best move score with played move score and if the difference is larger than a given threshold adds an annotation
5- repeats from 2 until game is over

You can annotate the game backwards if better for the engine (if the engine keeps the hash tables from one iteration to the other).

What's philosophically wrong with the above (besides being to complex for myself to do)???

:?:
Its not my philosophy issue, I personally support such a program. The issue is that UCI is meant to connect to a GUI. What you are proposing is a command line program which effectively does the job of the intended GUI. The functionally you mention above is supported in almost all UCI compatible GUIs. UCI was designed with a user interactive GUI as the primary client.

Your request for a command line analyze script is a different way of thinking which will be quite useful for testing on server environments. I do hope someone acts on it.
govert
Posts: 270
Joined: Thu Jan 15, 2009 12:52 pm

Re: is there an annotation tool for UCI (like crafty annotat

Post by govert »

shiv wrote:
casaschi wrote:
shiv wrote: As UCI aims to give more power to the GUI, command line auto-annotation is likely to be philosophically against UCI (though it can be done).
I dont understand your philosophy issue :-)

What would be the problem with a script that takes a polyglot style ini file for the engine configuration and then:
1- reads a game from a given PGN file
2- evaluates current position and best move/mainline
3- evaluates move played in the games
4- compares best move score with played move score and if the difference is larger than a given threshold adds an annotation
5- repeats from 2 until game is over

You can annotate the game backwards if better for the engine (if the engine keeps the hash tables from one iteration to the other).

What's philosophically wrong with the above (besides being to complex for myself to do)???

:?:
Its not my philosophy issue, I personally support such a program. The issue is that UCI is meant to connect to a GUI. What you are proposing is a command line program which effectively does the job of the intended GUI. The functionally you mention above is supported in almost all UCI compatible GUIs. UCI was designed with a user interactive GUI as the primary client.

Your request for a command line analyze script is a different way of thinking which will be quite useful for testing on server environments. I do hope someone acts on it.

I'm thinking a bit about the details on how to implement this:

let's say we're at the position after move nr "n" in the game.

1) Calculate Eval(n), and BestMove(n)
2) Make the game move "n+1"
3) Calculate Eval(n+1), BestMove(n+1)
4) If the game move "n+1" differs from BestMove(n), and Score(n+1) is worse for the side who just made the move and |Eval(n)-Eval(n+1)| > THRESHOLD then Annotate move "n"

The drawback with this is that you're comparing evaluations at different moves.

(You're comparing the Eval of position(n) with the Eval of position (n+1) and defining that as the level of the human "error".)
govert
Posts: 270
Joined: Thu Jan 15, 2009 12:52 pm

Re: is there an annotation tool for UCI (like crafty annotat

Post by govert »

It would be interesting to know from the GUI authors how they have implemented the "annotate" function.

Arena?
SCID?
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: is there an annotation tool for UCI (like crafty annotat

Post by michiguel »

govert wrote:It would be interesting to know from the GUI authors how they have implemented the "annotate" function.

Arena?
SCID?
I always wanted to implement an "annotate" function in Gaviota. However, this thread woke me up into the idea that it will be better to implement an adapter to plug Gaviota. In this way, it could be used with any other engine. It goes into my to do list! I can't do it right away, but I will do it. I have already an adapter that I use for debugging, I have the pgn parser, I just implemented the search moves function. I need to glue all the pieces together. I think it could be a very useful tool.

Miguel
casaschi
Posts: 164
Joined: Wed Dec 23, 2009 1:57 pm

Re: is there an annotation tool for UCI (like crafty annotat

Post by casaschi »

michiguel wrote:
I always wanted to implement an "annotate" function in Gaviota. However, this thread woke me up into the idea that it will be better to implement an adapter to plug Gaviota. In this way, it could be used with any other engine. It goes into my to do list! I can't do it right away, but I will do it. I have already an adapter that I use for debugging, I have the pgn parser, I just implemented the search moves function. I need to glue all the pieces together. I think it could be a very useful tool.

Miguel
Excellent! This is the reply I was hoping for in a chess programmers forum!
Please let us know here if you need help with testing your script.
govert
Posts: 270
Joined: Thu Jan 15, 2009 12:52 pm

Re: is there an annotation tool for UCI (like crafty annotat

Post by govert »

michiguel wrote:
govert wrote:It would be interesting to know from the GUI authors how they have implemented the "annotate" function.

Arena?
SCID?
I always wanted to implement an "annotate" function in Gaviota. However, this thread woke me up into the idea that it will be better to implement an adapter to plug Gaviota. In this way, it could be used with any other engine. It goes into my to do list! I can't do it right away, but I will do it. I have already an adapter that I use for debugging, I have the pgn parser, I just implemented the search moves function. I need to glue all the pieces together. I think it could be a very useful tool.

Miguel
searchmoves. I forgot about that functionality.
That would simplifiy things.

Miguel, may I ask which language you're planning to use for the adapter? If you haven't decided, let me suggest python! :)
shiv
Posts: 351
Joined: Sat Apr 01, 2006 2:03 am

Re: is there an annotation tool for UCI (like crafty annotat

Post by shiv »

govert wrote:It would be interesting to know from the GUI authors how they have implemented the "annotate" function.

Arena?
SCID?
Scid's implementation is open source and is viewable under tcl/tools/uci.tcl. I think this can be refactored to a command line tcl script (and moved to python fairly easily). We then need the location of the uci engine as a parameter.

Perhaps others are interesting in using this for standalone as well? This assumes that another solution will not get traction anytime soon.
casaschi
Posts: 164
Joined: Wed Dec 23, 2009 1:57 pm

Re: is there an annotation tool for UCI (like crafty annotat

Post by casaschi »

shiv wrote:Scid's implementation is open source and is viewable under tcl/tools/uci.tcl. I think this can be refactored to a command line tcl script (and moved to python fairly easily). We then need the location of the uci engine as a parameter.

Perhaps others are interesting in using this for standalone as well? This assumes that another solution will not get traction anytime soon.
if I remember properly, scid does a graphical annotation of the game producing a diagram showing the evaluation during the game, so the analysis part might be reusable but the actual generation of the output (the annotated pgn or html) has to be done new.