epideath wrote:Hi everyone,
I am coding an interface to uci chess engines and I can't seem to find much information about the GO parameters wTime, bTime, wInc, and bInc. I can add these values and track them with my own code. But I was wondering if this is something that the engine handles. If so then how would you go about getting this information from the chess engine? Or am I correct in that my interface software will have to manage movestogo and time remaining?
TIA for any help.
Gary
Yes, indeed, the whole philosophy of the UCI protocol is that:
* everything that can be done by the GUI should be done by the GUI
That includes things like
(i) opening book
(ii) clock, movestogo, and generally all notion of
state
The point is that,
state is the root of all evil. Imagine if the state is stored by both the GUI and the Engine. What if they disagree? How do they reconcile their state values? Imagine some nasty bugs, because the state maintained by your engine is wrong, and some bugs cannot be reproduced as a result...
All these idiotic made up problems, that typically arise in the Xboard protocol, do not even exist in the UCI world. That is why, the UCI protocol is always a much better choice than the Xboard one, especially for beginners who want to keep it simple.
So a proper UCI engine has no notion of state, and just receives everything from the GUI everytime. Of course there is still some state somewhere: eg. the hash table, that you typically flush upon receiving a "ucinewgame" command.
If in doubt, read the manual instead, and get the information from the horse's mouth:
http://download.shredderchess.com/div/uci.zip
One of the awckward consequences of that principle (eliminating state) is that an UCI interface will send to your engine a position command that looks like this:
Code: Select all
position startpos moves m(1) ... m(n)
WHen I first saw that, I thought it would be a ridiculous waste of time, but I was completely wrong for a couple of reasons:
1/ the real bottle neck is pipe I/O and task switching. parsing the string and playing the moves (assuming a reasonable implementation) is much faster than people usually imagine.
2/ there is actually zero overhead, because the GUI is compelled to send you an 'isready' and wait for 'readyok' after the position command. Only at this point the clock is started.
PS: The UCI protocol is case sensitive, so 'GO', 'wTime' and 'bTime' do not mean anything. I suppose these were typos.