Page 1 of 2

hanging piece at starting quiescence search - how to handle?

Posted: Sun Feb 22, 2015 6:10 pm
by SMIRF
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?

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

Posted: Sun Feb 22, 2015 6:18 pm
by syzygy
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.

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

Posted: Sun Feb 22, 2015 6:23 pm
by SMIRF
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?

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

Posted: Sun Feb 22, 2015 6:26 pm
by kbhearn
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

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

Posted: Sun Feb 22, 2015 6:49 pm
by hgm
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.

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

Posted: Sun Feb 22, 2015 7:29 pm
by Evert
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.

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

Posted: Sun Feb 22, 2015 7:37 pm
by bob
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...

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

Posted: Sun Feb 22, 2015 7:42 pm
by SMIRF
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.

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

Posted: Sun Feb 22, 2015 8:42 pm
by SMIRF
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.

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

Posted: Mon Feb 23, 2015 9:43 am
by lucasart
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")