How To Add UCI

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

DroopyPawn

How To Add UCI

Post by DroopyPawn »

I've written a program that creates random chess positions. I'd like to be able to hook into a UCI engine like Rybka for two reasons.

1. To give the position a score.

2. To actually play against the computer in my program, without having to copy to Fritz.

Any suggestions?
Aleks Peshkov
Posts: 892
Joined: Sun Nov 19, 2006 9:16 pm
Location: Russia

Re: How To Add UCI

Post by Aleks Peshkov »

Zlaire

Re: How To Add UCI

Post by Zlaire »

You don't actually hook into an engine. You use a (graphical) interface like Arena (http://www.playwitharena.com) or so. (Rybka is just an engine, not an interface)

I don't know what you mean by giving the position a score, you don't need UCI to do that.

The link Aleks posted is the specifications for the UCI protocol, as it says in the beginning all commands are sent and received via the standard input (System.out.print in Java for example). So basically you create a loop that waits for input, and then acts accordingly when it receives it, sending the answer when done.

Take a look at some open source engine for a general idea of how it's done.
DroopyPawn

Re: How To Add UCI

Post by DroopyPawn »

This looks helpful. Thanks.
DroopyPawn

Re: How To Add UCI

Post by DroopyPawn »

Jonatan Pettersson,
Perhaps I wasn't clear or maybe I just don't understand.

I currently have no interest in writing any soft of chess AI myself. Maybe later I will. Right now, I just want to use one that someone else has already written.

It's my understanding that I can send a FEN position to an engine (like Rybka, Fritz, Shredder) using UCI and have that engine return a score (positive numbers favor white and negative numbers favor black) and that the engine will also return the best move for that position given the side whose turn it is to move.

And I just wishfully thinking or is this possible?
jwes
Posts: 778
Joined: Sat Jul 01, 2006 7:11 am

Re: How To Add UCI

Post by jwes »

Polyglot can send epd positions to an uci engine and get the results. If you are using Linux or cygwin, you should easily be able to adapt the source to do what you want.
Zlaire

Re: How To Add UCI

Post by Zlaire »

DroopyPawn wrote:Jonatan Pettersson,
Perhaps I wasn't clear or maybe I just don't understand.

I currently have no interest in writing any soft of chess AI myself. Maybe later I will. Right now, I just want to use one that someone else has already written.

It's my understanding that I can send a FEN position to an engine (like Rybka, Fritz, Shredder) using UCI and have that engine return a score (positive numbers favor white and negative numbers favor black) and that the engine will also return the best move for that position given the side whose turn it is to move.

And I just wishfully thinking or is this possible?
Ok I see what you want now. Misunderstood your second point I guess (about playing against the computer in your program).

As said you might be able readjust something like Polyglot for this, but the easiest solution should be to simply write all the positions you want to a file in FEN format and then use Arena or such to let an engine go through the positions one by one and give them a score.

This way you can simply have Arena open and let your program output as many positions as you like, and when you want to know the score for them just run the FEN analysis in Arena.

No need for copy/pasting atleast. :)

To me it seems like a lot of work to actually write your own piece of software to connect to an engine for something this 'simple'.
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: How To Add UCI

Post by Dann Corbit »

You might try Arena in EPD analysis mode.
There are also tools for analyzing sets of positions with engines.
EPD2WB springs to mind.
http://www.quarkchess.de/quark/epd2wb.zip