Chess protocols and moves to avoid starting to search?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
phhnguyen
Posts: 1434
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Chess protocols and moves to avoid starting to search?

Post by phhnguyen »

When analysing a hard position / problem I usually see engines be stuck in a PV for very long time. As a human I can quickly guess there is no hope for that PV and want those engines to try other way / other PVs. In other words I need them to avoid starting their searches with some given moves (they are first moves of PVs I don't want those engines to search).

Is there anyways to do that, using chess GUI with Winboard / UCI protocols? If no should we add some new commands to protocols (your opinions)?

Thanks
User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Chess protocols and moves to avoid starting to search?

Post by hgm »

You can exclude moves from analysis. For UCI there is the 'searchmoves' keyword in the 'go' command, which should be followed by a list of allowed moves. Many engines do not implement this, though (and thus are not truly UCI compatible).

In WB protocol there are the GUI->engine commands

exclude MOVE
include MOVE


which can be used to add or remove moves from the excluded set one by one. Or by use of the word 'all' for MOVE in/exclude all moves at once. (Changing the position clears this set). These commands are only sent to engines that announced at startup it supported them, through sending

feature exclude=1

From WinBoard/XBoard you can toggle the exclusion state of a move by playing it with the Crtl key pressed, or by grabbing the piece with a double-click. There will also be a header line in the Engine-Output window that gives an overview of excluded moves (prefixed by a '-' to indicate their exclusion) and re-included moves (prefixed by '+'). Right-clicking on those also toggles the state of the move. The word 'bestmove' is part of the list, and can be clicked to exclude the first move of the most-recently printed PV, while the word 'tail' symbolizes all moves not explicitly shown in the exclusion header.
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Chess protocols and moves to avoid starting to search?

Post by Ras »

hgm wrote:Many engines do not implement this, though (and thus are not truly UCI compatible).
From a GUI point of view, the issue is that searchmoves is not optional in UCI, that's why it's not being announced in the options list after the "uci" command.

For broken UCI engines that don't implement this feature, the only way to know is to test it when starting the engine. The GUI can transmit a position where there is an easy and obvious move, like mate in 1, and then using searchmoves with another move. If the engine still reports the mating move as beginning of the PV, then it does not support searchmoves.
User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Chess protocols and moves to avoid starting to search?

Post by hgm »

I consider it evil to hide defects of other software. (Erosion of standards, and such.)
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Chess protocols and moves to avoid starting to search?

Post by Ras »

hgm wrote:I consider it evil to hide defects of other software. (Erosion of standards, and such.)
The alternative would be to shift the error handling to layer 8, which sucks even more.
User avatar
phhnguyen
Posts: 1434
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: Chess protocols and moves to avoid starting to search?

Post by phhnguyen »

That is exactly what I need. Thanks. How silly I am to miss them from documents :oops: