Kempelen wrote:Hello,
I am near to release my engine. At the moment it goes good with xboard, but I have implemented a draft uci handle module, but I dont like UCI. In each move, the GUI send something like:
position startpos moves e2e4 e7e6 g1f3 d7d5 e4d5 e6d5 d2d4 b8c6 c2c4 f8b4 b1c3
For my undestanding, this is very ugly. I dont clear hast tables between moves: my engine can transpose from one move to onother utilizing hash entries of previous searches. Also I store things like previus scores. The above strings force my to set a new position and make all moves in internal board without doing searches. Also I must clear the hash table, because if the move is a takeback, the age variable in the hash is newer and searhes will not going to overwrite.
Also, if I dont store scores, I will not able to calculate learning values for my book handling (By the way, I would like to handle the book and learning values, and not the GUI).
There are also other issues related to this way to handle UCI. At first sign, I really dont like the protocol.
Could someone point a correct way to handle this issues?
are you like me: dont like UCI? or am I the only that see bad things in it.
why is it so popular in top engines?
Best regards.
Fermin
Let me describe the basic part.
Let's start with position startpos, say you are white the gui will send position startpos then go ..., now you will search the best move and returns it say
bestmove e2e4. From that your move history has e2e4. You can also store its score. Now the gui will asks a move from your opp and opp returns a move say e7e6. The gui will send you position startpos moves e2e4 e7e6. What I did is to process only the last move in that string in that case I will look at move e7e6. Question, what if the gui has sent
Position startpos moves e2e4 b8c6 d2d4 e7e6?
To check that you are in sync with the moves sent by gui count the moves sent by gui, in this case it is 4 moves. When you look at your move history you only have 1 move, and expect to receive 2 moves!! Now check if you receive the ucinewgame command, the position you are receiving might be a new position not related to the previous position which in this case you have to start over recording your move history.
When playing games you usually receive 2 moves from the gui in this case.
So we continue, you receive position startpos moves e2e4 e7e6, look only at move e7e6 if legal you may record it in your move history and when you receive a go command then search a bestmove say d2d4. You also can record that move in your move history. So your history would look, e2e4 e7e6 d2d4.
Expect the gui will send 4 moves to you next time, the 4th move is the move from your opp and the first 3 moves is in your move history.
Learning is not a problem, the gui will not send you result command but you have the move history score plus the number of moves sent by gui. Take fritz interface for example. Near the end of game you will receive the typical position startpos moves .... More moves say 60 from both sides. Then suddenly the fritz will send position startpos moves g1f3. Why only 1 move my move history has more than 1? That signals to you that you are in a new game. That is fritz interface from chessbase, at least version 13 which I have. I already sent an email to support ucinewgame command. I don't know if this is supported in fritz 15 now.
Other interface like arena and
winboard they send ucinewgame command that would tell you that you should be ready for a new game and have to clear your move history after doing your learning stuff and other things.
One reason I use uci protocol is because of IDEA from aquarium gui. An amazing software that could record the analysis tree of your engine and compare the analysis tree of other engine. Side by side you can see the score of Sf for example and the score of your engine from a given position. Also because I want to see the beautiful notation with text and variation from chessbase interfaces, namely fritz and cb12. Also want to see the automatic analysis output using fritz with my uci engine, you may use blunder check, full game analysis and deep position analysis.
Another reason is I could test my engine in a fast TC like 5s + 100 ms with cutechess for example and could compare results with other uci engine at this fast TC. Your development could also be fast when using fast TC, but you have to take care of long TC as well, but at least you have a record of its performance in fast TC.