Reporting a draw in UCI

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

MOBMAT
Posts: 385
Joined: Sat Feb 04, 2017 11:57 pm
Location: USA

Reporting a draw in UCI

Post by MOBMAT »

if my engine detects a 3-fold repetition at the root before it move, meaning that the position at the root has been "seen" three times already, is there a way to report this through the UCI interface to request a draw?
i7-6700K @ 4.00Ghz 32Gb, Win 10 Home, EGTBs on PCI SSD
Benchmark: Stockfish15.1 NNUE x64 bmi2 (nps): 1277K
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Reporting a draw in UCI

Post by Evert »

No.
Under UCI the GUI is supposed to adjudicate the game, so the situation you describe should not occur.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Reporting a draw in UCI

Post by hgm »

In an invalid position you could refuse to move by printing "bestmove 0000", in this case with a draw score ("info score cp 0 pv 0000"). This is compliant with the UCI standard. And in the interpretation that the GUI must prevent this situation should ever occur, (which is dubious, as FIDE rules say that repetition and 50-move draws must be claimed, and are not automatic), everything would be compliant, no matter what you print.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Reporting a draw in UCI

Post by Evert »

hgm wrote:(which is dubious, as FIDE rules say that repetition and 50-move draws must be claimed, and are not automatic)
In which case the interpretation is that the GUI will claim automatically on the engine's behalf. Also debatable, but it's no different to the GUI resigning on behalf of the engine, or even playing out tablebase positions.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Reporting a draw in UCI

Post by hgm »

Well, in that interpretation the GUI could decide not to claim. So the situation is not illegal, (it violates neither FIDE rules nor UCI specs) and the engine should be prepared to handle it. Playing a null move would be a possible way to handle it. Arguably FIDE rules would allow you to do that in that situation (i.e. stop your clock without maing a move).
tpetzke
Posts: 686
Joined: Thu Mar 03, 2011 4:57 pm
Location: Germany

Re: Reporting a draw in UCI

Post by tpetzke »

Just play the move again that you played previously (that repeated the position) if you by now did still not find a better one and report a draw score.

All GUIs I know will end the match after 3fold repetition although they should wait for 5fold.

I would not report null moves, might be seen as an illegal move and lose the game.

Thomas...
Thomas...

=======
http://macechess.blogspot.com - iCE Chess Engine
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Reporting a draw in UCI

Post by hgm »

But who cares if you lose the game through a fault of the GUI, or a rule violation of the opponent? Never cater to bugs of others!