I agree but I think that the value of pawn shield should be clearly less than a pawn in case of no attack on the K-side.hgm wrote:Seems dangerous. If there isn't an attack now, there might be one later. And one thing is for sure: you won't be able to create a Pawn shield out of nothing. If the f, g, and h Pawn are missing, and a2, b2, and c2 are present, I would prefer Q-side castling even if there was no attack anywhere at all on the K-side.
Positional quiesence
Moderators: hgm, Rebel, chrisw
-
- Posts: 10300
- Joined: Thu Mar 09, 2006 12:37 am
- Location: Tel-Aviv Israel
Re: Positional quiesence
-
- Posts: 931
- Joined: Tue Mar 09, 2010 3:46 pm
- Location: New York
- Full name: Álvaro Begué (RuyDos)
Re: Positional quiesence
One thing we do is consider that the mere presence of enemy pieces on the board contribute a bit to the attacking score, because potentially they could come and organize an attack, so there is some bonus for having the pawn shield in the middle game, even if there are no attacking pieces; but this is a small bonus.hgm wrote:Seems dangerous. If there isn't an attack now, there might be one later. And one thing is for sure: you won't be able to create a Pawn shield out of nothing. If the f, g, and h Pawn are missing, and a2, b2, and c2 are present, I would prefer Q-side castling even if there was no attack anywhere at all on the K-side.
It might actually be OK to not have a bonus at all, because the search is pretty good at figuring out if the enemy pieces can possibly mount an attack or not. Ruy-López is an old engine and its search was never very good, so a lot of the decisions we made for the evaluation function might not apply to a modern fast searcher.
-
- Posts: 7220
- Joined: Mon May 27, 2013 10:31 am
Re: Positional quiesence
What is a big margin. In my program I give a penalty of 0.6 Pawns if it loses castling rights. Does that mean that moves that lose castling rights should be in quiescence search. Don't think so otherwise quiescence search gets too expensive.Uri Blass wrote:Big change in king safety evaluation after castling is of course a mistake and with a small bonus the engine is going to understand that delaying castling cause bigger positional problems so it is not going to do it.hgm wrote:Note that how much king safety is worth is really only a tangent to the issue I am raising. The point really is that no matter how large a bonus it brings, the engine will still refuse to do such a quiet move if the opponent can do it too. (And then, in self-play...) I could set the king safety on a central file to -900, and it would still prefer to sacrifice all its minors rather than being the first to castle. It wants to make sure it can castle on the last move before the horizon. The more it earns by castling, the less likely it is it will ever do it (if the opponent does not do it first).
I agree that moves that change the evaluation by a big margin should be part of the qsearch but castling in chess usually is not a move that change the evaluation by a big margin(and if it changes the evaluation by a big margin the solution is to fix your evaluation).
-
- Posts: 27808
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Positional quiesence
There is no point in putting moves that lose score in QS, no matter how big that loss is. The reason to search moves in QS is that they might improve on the stand-pat score. The only moves that destroy opponent castling rights are captures, and you would search those anyway for the material they bring.
Pawn pushes can create protected passers, which can certainly cause bonuses close to the Pawn value. While in the current position they might simple be traded. So rather than having all kind of complex evaluation terms that have to take account of whether backward Pawns are blocked or can be safely pushed, putting Pawn pushes in QS doesn't seem a crazy idea at all.
Pawn pushes can create protected passers, which can certainly cause bonuses close to the Pawn value. While in the current position they might simple be traded. So rather than having all kind of complex evaluation terms that have to take account of whether backward Pawns are blocked or can be safely pushed, putting Pawn pushes in QS doesn't seem a crazy idea at all.
-
- Posts: 5960
- Joined: Sun Jan 10, 2010 6:15 am
- Location: Maryland USA
Re: Positional quiesence
This is an interesting idea, worth testing. But how do you handle the very common case where the last move was a capture? Averaging would be silly, but just using the current eval score isn't right either, since it's an advantage to be on move in general. I suppose you could just use the normal stand-pat arbitrary penalty in this case, but perhaps you can suggest a more elegant solution.hgm wrote:This suggests an alternative approach to positional quiescence: if the final ply before QS is met by stand-pat (i.e. returns the evaluation score after the move), you would not take that eval score, but the average of the score before and after the move. Or, in other words, if you stand pat in reply to a non-capture, don't use currentEval, but average it with the previousEval of the parent, (which was likely better, from the POV of the side standing pat), to decide if you would still like to stand pat. This would strongly discourage saving good positional moves for the last ply of the branch.
-
- Posts: 27808
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Positional quiesence
I don't have any suggestion for that, other than the usual tempo bonus. When a branch ends with tactics it likely has upset the position, and it would seem an on-average larger advantage to be on move to restore order or grab opportunities than after a quiet move. So even when a tempo bonus applied universally to all evaluations might optimize to only a very small value, it cannot be excluded that after a capture a much higher value might be optimal. It might even be made dependent on the value of the piece that was captured: removal of Queens will disturb a position in general much more than capture of a Pawn.
-
- Posts: 5960
- Joined: Sun Jan 10, 2010 6:15 am
- Location: Maryland USA
Re: Positional quiesence
How would you suggest to handle the case where the last move was a non-capture but a score-losing positional move, which often happens when a piece was attacked and has to retreat to an inferior square? Surely averaging the last two scores makes no sense in this case.hgm wrote:I don't have any suggestion for that, other than the usual tempo bonus. When a branch ends with tactics it likely has upset the position, and it would seem an on-average larger advantage to be on move to restore order or grab opportunities than after a quiet move. So even when a tempo bonus applied universally to all evaluations might optimize to only a very small value, it cannot be excluded that after a capture a much higher value might be optimal. It might even be made dependent on the value of the piece that was captured: removal of Queens will disturb a position in general much more than capture of a Pawn.
-
- Posts: 27808
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Positional quiesence
Good point, I had not thought about that yet. My first reaction would be to just add a small non-capture tempo bonus to the eval. In other words,
standPatScore = max(curEval + TEMPOBONUS, (curEval + previousEval)/2);
So basically this would only invoke the previous evaluation if the last move was better than average. ((curEval + previousEval)/2 = curEval - (curEval - previousEval)/2 = curEval + opponentMoveGain/2)
standPatScore = max(curEval + TEMPOBONUS, (curEval + previousEval)/2);
So basically this would only invoke the previous evaluation if the last move was better than average. ((curEval + previousEval)/2 = curEval - (curEval - previousEval)/2 = curEval + opponentMoveGain/2)
-
- Posts: 5960
- Joined: Sun Jan 10, 2010 6:15 am
- Location: Maryland USA
Re: Positional quiesence
Actually that is exactly the way I would have done it before receiving this reply. I was hoping that you would have an even better idea..hgm wrote:Good point, I had not thought about that yet. My first reaction would be to just add a small non-capture tempo bonus to the eval. In other words,
standPatScore = max(curEval + TEMPOBONUS, (curEval + previousEval)/2);
So basically this would only invoke the previous evaluation if the last move was better than average. ((curEval + previousEval)/2 = curEval - (curEval - previousEval)/2 = curEval + opponentMoveGain/2)