Positional quiesence

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

BeyondCritics
Posts: 396
Joined: Sat May 05, 2012 2:48 pm
Full name: Oliver Roese

Re: Positional quiesence

Post by BeyondCritics »

Hi Uri,

in this position white has trumps as well: a strong bishop on c4, connected to a pawn wedge gives him currently some space advantage on the king side. The highly sophisticated pawn code of stockfish might take that into account too.
But if you think stockfish could be improved here, i am sure you would be welcomed as new stockfish developer :-)

Oliver
User avatar
cdani
Posts: 2204
Joined: Sat Jan 18, 2014 10:24 am
Location: Andorra

Re: Positional quiesence

Post by cdani »

hgm wrote: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).
Sure. So if some move it's that valuable, I think the right solution is to add it into quiescence, and be sure that the rival really can not do it in any case.
User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Positional quiesence

Post by hgm »

Indeed, that would be a fundamentally sound solution. And it works when the moves that you thus have to consider in QS run out, like castlings and captures would certainly do. (Pawn pushes would be other 'safe' candidates for this.)

However, in a game where there would be very many such moves, this is no longer feasible.
User avatar
cdani
Posts: 2204
Joined: Sat Jan 18, 2014 10:24 am
Location: Andorra

Re: Positional quiesence

Post by cdani »

hgm wrote:However, in a game where there would be very many such moves, this is no longer feasible.
So maybe we are talking of a game not well suited for the standard way of programming chess engines. May be it's worth some other more statistical approach, like trying to play many ultra quick games to have some statistics of the reliability of the position.
User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Positional quiesence

Post by hgm »

Maybe. But MC methods heve never been very competitive in games where fairly accurate evaluations exist. Even for Shogi, where quiescence is a huge problem, all engines of GM strength use alpha-beta search, and experimental engines that use MC-UCT follow some 1000-2000 Elo behind,
User avatar
cdani
Posts: 2204
Joined: Sat Jan 18, 2014 10:24 am
Location: Andorra

Re: Positional quiesence

Post by cdani »

Maybe it's possible to order the moves giving priority to ones that gives best general evaluation of the position, instead of using bonus for the type of moves.

I use it in Andscacs for only the immediate alpha beta after the root move and seem to work, but not for deeper levels, I did not analyzed why.
Uri Blass
Posts: 10282
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Positional quiesence

Post by Uri Blass »

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).
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.

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).
Uri Blass
Posts: 10282
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Positional quiesence

Post by Uri Blass »

BeyondCritics wrote:Hi Uri,

in this position white has trumps as well: a strong bishop on c4, connected to a pawn wedge gives him currently some space advantage on the king side. The highly sophisticated pawn code of stockfish might take that into account too.
But if you think stockfish could be improved here, i am sure you would be welcomed as new stockfish developer :-)

Oliver
I did not claim that stockfish is bad here.
My point is that pawn shield has no big importance in chess as long as the squares near the king are not attacked.

here is another position that I composed

[D]2kr1b1r/ppp2ppp/2n1pn2/q7/5PbP/2NP1NP1/PPP1B3/R1BQ1RK1 w - - 7 1

black has some advantage but only something like half a pawn

when the pawns are at h2 g2 f2 the position is equal.

at depth 1 stockfish shows Be3 in both cases when in one case the evaluation is 0.68 for white and in the second case 0.14 for white(later it goes down when stockfish see that black move the king to safer square(b8) and develop the bishop to get better mobility

Here is stockfish evaluations at depths 1-4 from the diagram with no pawn shield for white(I guess the main advantage of Kb8 is piece square table bonus and not something that is about pawn shield).

FEN: 2kr1b1r/ppp2ppp/2n1pn2/q7/5PbP/2NP1NP1/PPP1B3/R1BQ1RK1 w - - 7 1

Stockfish_14041213_x64_modern_sse42:
1/1 00:00 204 102,000 +0.14 Bc1-e3
2/2 00:00 636 318,000 -0.25 Bc1-e3 Kc8-b8
3/3 00:00 1,520 506,666 -0.12 Bc1-e3 Kc8-b8 a2-a3
4/4 00:00 2,223 555,750 -0.47 Bc1-e3 Kc8-b8 a2-a3 Bf8-c5
AlvaroBegue
Posts: 931
Joined: Tue Mar 09, 2010 3:46 pm
Location: New York
Full name: Álvaro Begué (RuyDos)

Re: Positional quiesence

Post by AlvaroBegue »

Uri Blass wrote: I did not claim that stockfish is bad here.
My point is that pawn shield has no big importance in chess as long as the squares near the king are not attacked.
In the evaluation of attacks in Ruy-López, we compute a number that measures how messed up is the shield and a number that measures the strength of the attack. The contribution to the score is something like the product of both (with lots of special cases hacked in). So bad pawn shield is not penalized if there is no attack. This seems perfectly reasonable to me and I am not surprised other engines implement similar ideas.

There are similar ideas sketched out in the CPW: https://chessprogramming.wikispaces.com/King+Safety
User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Positional quiesence

Post by hgm »

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.