ChessGUI 0.245h

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: ChessGUI 0.245h

Post by Ferdy »

hgm wrote:
Ferdy wrote:

Code: Select all

<< bestmove g3g6
Takeback the last move in internal board
<<<<<<
string received&#58; stop
>> stop
Deuterium is no longer searching, and bestmove was already sent
<< bestmove 0000
This is a bad violation of UCI protocol. An engine should NEVER produce more than one 'bestmove' command in response to a 'go' command. (And also never fewer than one, btw.)
According to uci protocol.

Code: Select all

* bestmove <move1> &#91; ponder <move2> &#93;
	the engine has stopped searching and found the move <move> best in this position.
	the engine can send the move it likes to ponder on. The engine must not start pondering automatically.
	this command must always be sent if the engine stops searching, also in pondering mode if there is a
	"stop" command, so for every "go" command a "bestmove" command is needed!
	Directly before that the engine should send a final "info" command with the final search information,
	the the GUI has the complete statistics about the last search.
There was no such thing as "should NEVER produce more than one bestmove".
Also Deuterium was provoked to send bestmove 0000 because it received two stop commands, it does not send bestmove zzzz, bestmove yyyy without a command from GUI.

But of course I can ignore the second stop command. But in the protocol
it does not say that I am not allowed not to ignore, I still have the choice not to ignore.
That would mean that the GUI should have full control of the situation, such as not sending a second stop command when the engine had already sent its bestmove.

Code: Select all

* if the engine receives a command which is not supposed to come, for example "stop" when the engine is
  not calculating, it should also just ignore it.
Xann
Posts: 127
Joined: Sat Jan 22, 2011 7:14 pm
Location: Lille, France

Re: ChessGUI 0.245h

Post by Xann »

Ferdy wrote:There was no such thing as "should NEVER produce more than one bestmove".
Also Deuterium was provoked to send best move 0000 because it received two stop commands, it does not send best move zzzz, best move yyyy without a command from GUI.
'go' and 'bestmove' go in pairs (as brackets). In general a UCI GUI can send 'stop' during time searches (not infinite), and there is never a guarantee that the engine will still be searching when processing it. So the only solution is to ignore 'stop' when not searching. Another way of seing it is that 'go' eventually requires an answer, while 'stop' doesn't.

Fabien.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: ChessGUI 0.245h

Post by Ferdy »

Xann wrote:
Ferdy wrote:There was no such thing as "should NEVER produce more than one bestmove".
Also Deuterium was provoked to send best move 0000 because it received two stop commands, it does not send best move zzzz, best move yyyy without a command from GUI.
'go' and 'bestmove' go in pairs (as brackets).
Correct.
Xann wrote: In general a UCI GUI can send 'stop' during time searches (not infinite),
I doubt that, according to protocol.

Code: Select all

	* infinite
		search until the "stop" command. Do not exit the search without being told so in this mode!
Xann
Posts: 127
Joined: Sat Jan 22, 2011 7:14 pm
Location: Lille, France

Re: ChessGUI 0.245h

Post by Xann »

Ferdy wrote:
Xann wrote:In general a UCI GUI can send 'stop' during time searches (not infinite),
I doubt that, according to protocol.

Code: Select all

	* infinite
		search until the "stop" command. Do not exit the search without being told so in this mode!
Sorry for the confusion, I meant:
In general a UCI GUI can also send 'stop' during timed searches. By "timed search" I mean "not infinite".
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: ChessGUI 0.245h

Post by Ferdy »

Xann wrote:
Ferdy wrote:
Xann wrote:In general a UCI GUI can send 'stop' during time searches (not infinite),
I doubt that, according to protocol.

Code: Select all

	* infinite
		search until the "stop" command. Do not exit the search without being told so in this mode!
Sorry for the confusion, I meant:
In general a UCI GUI can also send 'stop' during timed searches. By "timed search" I mean "not infinite".

Agreed the gui is the boss, and after receiving the stop command the engine will reply with bestmove yyyy.
Charly
Posts: 1091
Joined: Wed Jul 23, 2014 4:30 pm
Location: Bretagne

Re: ChessGUI 0.245h

Post by Charly »

Many thanks, Matthias, for your work on this great GUI !

I hope you'll keep working on it.

Arnaud
Brittany from the sky :
https://youtu.be/nR9eU_tVbxE
User avatar
Matthias Gemuh
Posts: 3245
Joined: Thu Mar 09, 2006 9:10 am

Re: ChessGUI 0.245h

Post by Matthias Gemuh »

Matthias Gemuh wrote:...
1) Solving testsuites
- Some UCI engines treat "go infinite" in a strange manner, so solving
testsuites fails for them (Fire4, Gull3, etc).

...

The conflict was about how to handle "stop" when not searching.
Engine that ignored it worked fine. Engines that felt compelled to act,
choked.
The delibrate "stop" before a new FEN was meant to stop any engine that may be searching "out of sync". As it instead causes some engines to choke, I have taken it out.
BTW, there are some more fixes (unrelated to testsuites) because I ugraded my compiler.

Matthias.
My engine was quite strong till I added knowledge to it.
http://www.chess.hylogic.de
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: ChessGUI 0.245h

Post by hgm »

Ferdy wrote:

Code: Select all

* if the engine receives a command which is not supposed to come, for example "stop" when the engine is
  not calculating, it should also just ignore it.
Well, that is what I said, and is seems not in any way ambiguous. It specifies the engine should ignore 'stop' when not searching. That does not mean ignoring it is optional, and that you can also elect to send a 'bestmove 0000' command in reply to it.

It is not possible for the GUI to know if the 'bestmove' is a reply to the next search it orders. They could have crossed.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: ChessGUI 0.245h

Post by hgm »

Matthias Gemuh wrote:The delibrate "stop" before a new FEN was meant to stop any engine that may be searching "out of sync".
You do wait for 'bestmove' before ordering a new search? Are there really engines that still search on after emitting a 'bestmove', and choke on altering the position? (If so, I don't think there is any reason to believe repeating 'stop' would help.)

I know there are engines that cannot handle commands received after 'stop', but before they printed 'bestmove'. Apparently they do not queue such commands while busy. This is why Polyglot has the SyncStop option, and in UCI2WB I always use that mode.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: ChessGUI 0.245h

Post by Ferdy »

Matthias Gemuh wrote:
Matthias Gemuh wrote:...
1) Solving testsuites
- Some UCI engines treat "go infinite" in a strange manner, so solving
testsuites fails for them (Fire4, Gull3, etc).

...

The conflict was about how to handle "stop" when not searching.
Engine that ignored it worked fine. Engines that felt compelled to act,
choked.
The delibrate "stop" before a new FEN was meant to stop any engine that may be searching "out of sync". As it instead causes some engines to choke, I have taken it out.
It was the GUI that has choked, because the GUI is fully aware that it sent its first stop command, and the engine replied with bestmove to that, so the GUI knew that the engine has replied with bestmove from GUI's first stop command. So why the GUI sends again the stop command? (they are in sync after the engine sent its first bestmove reply after the first stop command). If the GUI received the second bestmove 0000, it should have ignored this move, because the GUI knew that it was just testing the engine using the second stop command.
Also in the protocol it does not say "do not reply anything to the stop command when you are no longer searching and has already sent the bestmove".
That would mean that if the GUI sent stop command 10x, the engine has the option to reply bestmove 10x too. The GUI should adjust in this situation because it sent stop command 10x in the first place.