hanging piece at starting quiescence search - how to handle?

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
User avatar
SMIRF
Posts: 91
Joined: Wed Mar 26, 2014 3:29 pm
Location: Buettelborn/Hessen/Germany
Contact:

hanging piece at starting quiescence search - how to handle?

Post by SMIRF » Sun Feb 22, 2015 6:10 pm

During quiescence search there when not in check - as far as I have understood - only captures should be investigated. But there could be a hanging piece, which asks for a defending or covering move. How should this situation be handled?

syzygy
Posts: 4450
Joined: Tue Feb 28, 2012 10:56 pm

Re: hanging piece at starting quiescence search - how to han

Post by syzygy » Sun Feb 22, 2015 6:18 pm

SMIRF wrote:During quiescence search there when not in check - as far as I have understood - only captures should be investigated. But there could be a hanging piece, which asks for a defending or covering move. How should this situation be handled?
Entirely up to you, but the usual approach is: ignore.

User avatar
SMIRF
Posts: 91
Joined: Wed Mar 26, 2014 3:29 pm
Location: Buettelborn/Hessen/Germany
Contact:

Re: hanging piece at starting quiescence search - how to han

Post by SMIRF » Sun Feb 22, 2015 6:23 pm

syzygy wrote:
SMIRF wrote:During quiescence search there when not in check - as far as I have understood - only captures should be investigated. But there could be a hanging piece, which asks for a defending or covering move. How should this situation be handled?
Entirely up to you, but the usual approach is: ignore.
Does that mean: when there are no capture moves but still hanging pieces, then a stand-pat evaluation would be ok?

kbhearn
Posts: 411
Joined: Thu Dec 30, 2010 3:48 am

Re: hanging piece at starting quiescence search - how to han

Post by kbhearn » Sun Feb 22, 2015 6:26 pm

You ignore said hanging piece by the moving side under the assumption that if you had more search depth you'd have a way to save it or create a counterthreat.

Quiescence's job is not to come up with a perfect final evaluation, but just to avoid ending search lines with suicide capture and completely bogus evals attached to them. Including much more than captures can cause a search explosion as there's no guarantee the tree will come to an end.

Worrying about a focus on 'other tactical considerations' could be a stage before hitting quiescence.

for example:
depth remaining > 5 : full width search with assorted reductions.
5 >= depth remaining > 0 : selective search where you can include any moves you feel are important, or stand pat to take a cutoff if you feel there's nothing that needs to be investigated further.
0 >= depth remaining : quiescent search, captures only

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

Re: hanging piece at starting quiescence search - how to han

Post by hgm » Sun Feb 22, 2015 6:49 pm

The default assumption is that having the move will be good enough to resolve any threats against you (except when in check). This is true in such a lare fraction of the leaves that it is very hard to justify any additional effort aimed at being more accurate.

We do check extension to make sure the King can get out of harm's way when attacked, but we don't do an extension for an attack on the Queen. The reason is that the Queen is so powerful that it can almost always escape. And the lower the mobility of a piece, the smaller the chances there is an attack on it that you could not fend of by protecting it (if it isn't protected already): there is a strong correlation between the mobility of a piece, and its value. Except for King.

Of course if you want to have a smarter QS, you could make it worry when there are multiple hanging pieces, as the default assumption should be that you can only save one of those. Either discount the lowest-valued pieceit in the eval, to have a guess that s more often correct, or extend to make sure.

User avatar
Evert
Posts: 2923
Joined: Fri Jan 21, 2011 11:42 pm
Location: NL
Contact:

Re: hanging piece at starting quiescence search - how to han

Post by Evert » Sun Feb 22, 2015 7:29 pm

SMIRF wrote:During quiescence search there when not in check - as far as I have understood - only captures should be investigated. But there could be a hanging piece, which asks for a defending or covering move. How should this situation be handled?
If the opponent hangs a piece you gobble it up during QS (you'd do that on the first ply of QS since during QS you would not normally hang new pieces unless there's a problem with overloading - which is exactly the sort of tactic QS is meant to detect).
If you hang a piece the opponent will gobble it up on the next iteration of the iterative deepening loop.

Now, you could play a null-move and call QS to detect this situation. The question is what you do if it comes back and tells you you have a hanging piece. Extend the search to protect it? Leads to search explosion.

Something I have found to sort-of work in 10x8 variants is to penalise loose/hanging pieces in the evaluation. In 8x8 orthochess this seems to work somewhat less well, in my experience. Ultimately though, this is an evaluation term that tries to compensate for inadequacies in the search. Expect diminishing returns as the search depth increases.

EDIT: wanted to add: the tree near the leaves is pretty unreliable anyway (it's based on a shallow search, after all) and this is not a problem: in the end only the move at the root of the tree needs to not be crap.

bob
Posts: 20474
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: hanging piece at starting quiescence search - how to han

Post by bob » Sun Feb 22, 2015 7:37 pm

SMIRF wrote:
syzygy wrote:
SMIRF wrote:During quiescence search there when not in check - as far as I have understood - only captures should be investigated. But there could be a hanging piece, which asks for a defending or covering move. How should this situation be handled?
Entirely up to you, but the usual approach is: ignore.
Does that mean: when there are no capture moves but still hanging pieces, then a stand-pat evaluation would be ok?
Yes. And 99% of the time this is safe, because instead of standing pat, you could move the hanging piece or else defend it since it is your move...

User avatar
SMIRF
Posts: 91
Joined: Wed Mar 26, 2014 3:29 pm
Location: Buettelborn/Hessen/Germany
Contact:

Re: hanging piece at starting quiescence search - how to han

Post by SMIRF » Sun Feb 22, 2015 7:42 pm

Evert wrote:Something I have found to sort-of work in 10x8 variants is to penalise loose/hanging pieces in the evaluation. In 8x8 orthochess this seems to work somewhat less well, in my experience. Ultimately though, this is an evaluation term that tries to compensate for inadequacies in the search. Expect diminishing returns as the search depth increases.
Well, having one hanging piece, this might be ignorable, supposing it could move out of the threat or be covered. Then giving a penalty to the evaluation would lead to underestimate the situation, which is also wrong.

There is another different idea for quiescence search I am thinking of. As for variants like Arimaa with a huge amount of moves there it seems to be nearly impossible to inspect all combined moves of a ply. This leads to the question, why human beings are able to play Arimaa or Chess, whereas it intends to be so hard for engines. I try to experiment with an idea, which may help then to evaluate. Maybe in Chess it helps to create a different solution to the qiescence problem ... but it is not yet a working algorithm.

User avatar
SMIRF
Posts: 91
Joined: Wed Mar 26, 2014 3:29 pm
Location: Buettelborn/Hessen/Germany
Contact:

Re: hanging piece at starting quiescence search - how to han

Post by SMIRF » Sun Feb 22, 2015 8:42 pm

The longer I am thinking about that problem the more I conclude following: the handling of quiescence search when standing in check is not an exception because of the king being in check, but because there is a bigger own piece threatened than any of the opponent.

Following that observation I like to extend that search behaviour to the added clause: if there is an own piece threatened and this is bigger than any threatened from the opposite side, then do a full expand and evaluate.

I hope this will perform more reliably.

User avatar
lucasart
Posts: 3037
Joined: Mon May 31, 2010 11:29 am
Full name: lucasart
Contact:

Re: hanging piece at starting quiescence search - how to han

Post by lucasart » Mon Feb 23, 2015 9:43 am

syzygy wrote:
SMIRF wrote:During quiescence search there when not in check - as far as I have understood - only captures should be investigated. But there could be a hanging piece, which asks for a defending or covering move. How should this situation be handled?
Entirely up to you, but the usual approach is: ignore.
The usual approach is ignore *in the search*, but try to compensate in the eval. See evaluate_threats() in SF.

In DiscoCheck, I count hanging pieces for stand pat score (not only in QS but mostly). One is fine, two or more the assumption is that you're likely to lost the least valuable one, so the penalty is proportional to its value (plus a constant that you can think as loss of tempo to move or defend the other piece).

So the DiscoCheck way is asymmetric and handled by the search, while SF way is handled by the symmetric eval. Not much difference in the end, it's all a black art of making random tweaks and tuning them.

There's no clean way to handle in the search this problem. None that works in practice (as opposed to "on paper")

Post Reply