Hi,
While implementing UCI I noticed it is not specified what the engine should report when it cannot do a move.
I do not mean in a checkmate situation but for example when it would encounter a 3-repeats move.
http://www.shredderchess.com/chess-info ... rface.html doesn't specify it, it seems
UCI protocol: giving up!
Moderator: Ras
-
ZirconiumX
- Posts: 1362
- Joined: Sun Jul 17, 2011 11:14 am
- Full name: Hannah Ravensloft
Re: UCI protocol: giving up!
The GUI should handle that - so don't worry.
If the GUI dows send a go command for a threefold rep then send bestmove 0000.
Matthew:out
If the GUI dows send a go command for a threefold rep then send bestmove 0000.
Matthew:out
tu ne cede malis, sed contra audentior ito
-
mar
- Posts: 2681
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: UCI protocol: giving up!
Why? The GUI should never send an illegal move. And when you do a root search you should ignore all draws by repetition and stuff like that. The engine must output a move whenever it's asked to.flok wrote:Hi,
While implementing UCI I noticed it is not specified what the engine should report when it cannot do a move.
I do not mean in a checkmate situation but for example when it would encounter a 3-repeats move.
http://www.shredderchess.com/chess-info ... rface.html doesn't specify it, it seems
Hope that helps and don't give up!
Martin
-
flok
Re: UCI protocol: giving up!
Ok, that's what I'll do.
I think I'll give it a penalty to the score instead.
I think I'll give it a penalty to the score instead.
-
Sven
- Posts: 4052
- Joined: Thu May 15, 2008 9:57 pm
- Location: Berlin, Germany
- Full name: Sven Schüle
Re: UCI protocol: giving up!
There is no need even for such a penalty. If the GUI sends "go" but there is no legal move in the root position (mate, stalemate) then send "bestmove 0000", as already proposed. If the GUI sends "go" in a position that could have been claimed as a draw by rule (50 moves rule, threefold repetition, insufficient material) but was actually not claimed then do a normal search and ignore the behaviour of the GUI. This does also not change anything for your normal draw detection within the search, so you might actually return a best move that enforces a draw by 50 moves rule, for instance.flok wrote:Ok, that's what I'll do.
I think I'll give it a penalty to the score instead.
Sven
-
hgm
- Posts: 28478
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: UCI protocol: giving up!
UCI specs allow you to send a null move. The GUI would understand from this that you don't want to move (if it is any good, that is..).
In the score you could specify whether you think this makes the game end in a win, loss or draw. For instance, if you are checkmated in the current position, it would make sense to think that you will lose this game, and report -M0. If you let the engine refuse to play on after a 3-fold rep, it would make sense to report a draw score.
Of course I would not recommend anyone to use UCI at all.
In the score you could specify whether you think this makes the game end in a win, loss or draw. For instance, if you are checkmated in the current position, it would make sense to think that you will lose this game, and report -M0. If you let the engine refuse to play on after a 3-fold rep, it would make sense to report a draw score.
Of course I would not recommend anyone to use UCI at all.
-
lucasart
- Posts: 3243
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
Re: UCI protocol: giving up!
and why would you ever end up in this situation ? If it happens it means the GUI is buggy!flok wrote:Hi,
While implementing UCI I noticed it is not specified what the engine should report when it cannot do a move.
I do not mean in a checkmate situation but for example when it would encounter a 3-repeats move.
http://www.shredderchess.com/chess-info ... rface.html doesn't specify it, it seems
-
lucasart
- Posts: 3243
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
Re: UCI protocol: giving up!
Nor would I recommend to anyone using the Xboard protocolhgm wrote:Of course I would not recommend anyone to use UCI at all.
-
lucasart
- Posts: 3243
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
Re: UCI protocol: giving up!
yes, i guess it's the only thing that would make sense. but we're talking about a hypothetical situation that would never happen.ZirconiumX wrote:The GUI should handle that - so don't worry.
If the GUI dows send a go command for a threefold rep then send bestmove 0000.
Matthew:out
alternatively you could just exit the program with an error code, and dump a message in stderr, saying the GUI is sending illegal moves...
-
lucasart
- Posts: 3243
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
Re: UCI protocol: giving up!
The most basic implementation of UCI you should do is as follows:flok wrote:Hi,
While implementing UCI I noticed it is not specified what the engine should report when it cannot do a move.
I do not mean in a checkmate situation but for example when it would encounter a 3-repeats move.
http://www.shredderchess.com/chess-info ... rface.html doesn't specify it, it seems
* when you recieve "uci" just answer "uciok"
* be prepared to handle position commands, eg.
position startpos moves e2e4 c7c5
position fen ... moves d4e5
* be prepared to handle go commands, there are several types of parameters to limit the search (time+inc, time, depth, nodes etc.). the most simple one is a fixed time per move (in ms)
go movetime 1000
so now you do a 1sec search, and return something like
bestmove e2e4
and that's all you need to get started !
Also your program will benefit from the book of the GUI. One of the many advantages of UCI vs Xboard