Not sure about that. I think many engines evaluate even in case of check in the last plies of qs.D Sceviour wrote:Positions that are in check are not interesting or useful to evaluate.
king safety: hard positions for zurichess
Moderators: hgm, Dann Corbit, Harvey Williamson
-
brtzsnr
- Posts: 433
- Joined: Fri Jan 16, 2015 4:02 pm
Re: king safety: hard positions for zurichess
zurichess - http://www.zurichess.xyz
-
D Sceviour
- Posts: 570
- Joined: Mon Jul 20, 2015 5:06 pm
Re: king safety: hard positions for zurichess
It may be possible, but the complexities in QS of determining whether the check is a legal move would make it unprofitable, IMHO. Performing a check evasion and then evaluating is more effective for me.brtzsnr wrote:Not sure about that. I think many engines evaluate even in case of check in the last plies of qs.D Sceviour wrote:Positions that are in check are not interesting or useful to evaluate.
-
bob
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: king safety: hard positions for zurichess
First, 300 games has a huge error bar. +/- 50 or so. Surely you don't think it gives enough of a boost that it can be measured with that level of error??? I can comment it out in Stockfish 7 and test to +/- 3 Elo accuracy quite easily if you don't have good numbers...D Sceviour wrote:I recently added a Queen contact evaluation to one of two otherwise identical programs. A 300 game match showed a significant increase in elo, so the risk is worth it. King safety is very important as variations in evaluations are larger than any other evaluation - even material.bob wrote: Queen contact checks in return for giving up an exchange is risky..
BTW most have larger variations in passed pawn evaluations, particularly when one side has no pieces left.
-
D Sceviour
- Posts: 570
- Joined: Mon Jul 20, 2015 5:06 pm
Re: king safety: hard positions for zurichess
37 elo results, but as you indicated, the variation for only two engines is augmented. Other engine results would be interesting. I intend to include the Queen contact check safety for now. Further refinements should improve the results even more.bob wrote:First, 300 games has a huge error bar. +/- 50 or so. Surely you don't think it gives enough of a boost that it can be measured with that level of error??? I can comment it out in Stockfish 7 and test to +/- 3 Elo accuracy quite easily if you don't have good numbers...D Sceviour wrote:I recently added a Queen contact evaluation to one of two otherwise identical programs. A 300 game match showed a significant increase in elo, so the risk is worth it. King safety is very important as variations in evaluations are larger than any other evaluation - even material.bob wrote: Queen contact checks in return for giving up an exchange is risky..
BTW most have larger variations in passed pawn evaluations, particularly when one side has no pieces left.
I do not evaluate king safety in a king-pawn endgame (meaning king_safety=0). Passed pawns are never valued more than 200 centipawns until they queen. King safety can be evaluated as much or larger than that, as can be seen from the Stockfish evaluation of the position given above.
-
fierz
- Posts: 72
- Joined: Mon Mar 07, 2016 4:41 pm
- Location: Zürich, Switzerland
Re: king safety: hard positions for zurichess
D Sceviour wrote:Positions that are in check are not interesting or useful to evaluate. The engine should evade the check and then evaluate. Here is a more interesting position from a recent game that Spartacus won:
[d]3r4/1p1rB1k1/p1p1p1p1/P3P1Pq/1P1R1Q1p/5P1P/6K1/8 b - -
Many engines will assess the position as better for black because of the advantage of material and the weakness of the white king. However, Stockfish correctly evaluates this as a win for white, mainly because of extra code that evaluates the danger of Queen contact.
I also have pretty speculative king evaluations in my engine, and sometimes they give rise to nice attacks, and sometimes they crash and burn. I don't think you can resolve a position like this by evaluation, when it is nicely resolved by a proper qsearch. That said, I can easily imagine that on average, adding queen contact checks to the eval is helpful.
In any case, in this particular position, the fact that white is doing fine, even though black to move can capture a rook and is already an exchange up, is purely tactical and not really to do with a queen contact check - after the most natural move ...Rxd4 white has Qf6+ (contact check!), Kg8 (forced) Qxe6+ and whatever black does he is lost (Kg7 Bf6+ etc). (I just looked at the position as a human, hope I made no mistake). Anyway, let's say you remove the pawn on c6 and replace it by a pawn on f7 which prevents the catastrophe for the black king without changing the material balance. Again, without checking with the engine, black should now be winning, but white still has this contact check on f6 - so does stockfish really now evaluate it as winning for black?
cheers
Martin
-
bob
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: king safety: hard positions for zurichess
So you would not sacrifice your last remaining rook to capture your opponent's last remaining knight, giving you a passed pawn that can not be stopped by the lone king??? Most do this...D Sceviour wrote:37 elo results, but as you indicated, the variation for only two engines is augmented. Other engine results would be interesting. I intend to include the Queen contact check safety for now. Further refinements should improve the results even more.bob wrote:First, 300 games has a huge error bar. +/- 50 or so. Surely you don't think it gives enough of a boost that it can be measured with that level of error??? I can comment it out in Stockfish 7 and test to +/- 3 Elo accuracy quite easily if you don't have good numbers...D Sceviour wrote:I recently added a Queen contact evaluation to one of two otherwise identical programs. A 300 game match showed a significant increase in elo, so the risk is worth it. King safety is very important as variations in evaluations are larger than any other evaluation - even material.bob wrote: Queen contact checks in return for giving up an exchange is risky..
BTW most have larger variations in passed pawn evaluations, particularly when one side has no pieces left.
I do not evaluate king safety in a king-pawn endgame (meaning king_safety=0). Passed pawns are never valued more than 200 centipawns until they queen. King safety can be evaluated as much or larger than that, as can be seen from the Stockfish evaluation of the position given above.
If by 37 Elo results you mean A was 0 and B was 37, both have a roughly +/-50 error bar. That is completely inconclusive as a result... And comparing A vs A' tends to inflate any rating difference as well.
-
jdart
- Posts: 4361
- Joined: Fri Mar 10, 2006 5:23 am
- Location: http://www.arasanchess.org
Re: king safety: hard positions for zurichess
You should look just at the king safety component of the eval, not at the total eval. For example this one:
[D] 2k3rr/2P5/8/5p2/pP2pb2/P2P3Q/1R3P1K/N2R4 w - - 0 1
has imbalanced material (White has much more) although Black has a a mate threat. As others have noted you should not expect to evaluate this statically to a Black win (if you did this, n fact you would probably be scoring king attacks too high).
But you can look for positions where the king safety component is not evaluated correctly. One set of problems mine has trouble with is where there are potential attacks on the squares near the king, but the attacking piece(s) are behind pawns or other pieces. Sometimes the pawns are effective attackers and sometimes they are not. Here is an example:
[D] r2r2k1/6pp/b2pp1p1/q7/1p1BPP1P/pP1P1Q2/P7/1KR4R w - - 0 1
This looks pretty balanced to me. The Black pawns may look like an "attack" but they are immobile. White can play h5. But after Qb5, Black has counterplay.
Another tricky one is attacks on the King with reduced material. Most engines scale down attack scores as the attacking side's material is reduced. But most chessplayers know that you can sometimes generate mating threats even in the endgame.
All that said, you can go a long way if you just do something simple: count the "weight" (total value) of pieces that attack the King or squares near it, and scale this by the attacking side's material. Also give a penalty for damaging the King shelter. Tune the bonus/penalty until your program does not play into attacks blindly. But do not tune so high that it starts sacrificing material for unsound attacks - that is entertaining to watch but will lose games.
--Jon
[D] 2k3rr/2P5/8/5p2/pP2pb2/P2P3Q/1R3P1K/N2R4 w - - 0 1
has imbalanced material (White has much more) although Black has a a mate threat. As others have noted you should not expect to evaluate this statically to a Black win (if you did this, n fact you would probably be scoring king attacks too high).
But you can look for positions where the king safety component is not evaluated correctly. One set of problems mine has trouble with is where there are potential attacks on the squares near the king, but the attacking piece(s) are behind pawns or other pieces. Sometimes the pawns are effective attackers and sometimes they are not. Here is an example:
[D] r2r2k1/6pp/b2pp1p1/q7/1p1BPP1P/pP1P1Q2/P7/1KR4R w - - 0 1
This looks pretty balanced to me. The Black pawns may look like an "attack" but they are immobile. White can play h5. But after Qb5, Black has counterplay.
Another tricky one is attacks on the King with reduced material. Most engines scale down attack scores as the attacking side's material is reduced. But most chessplayers know that you can sometimes generate mating threats even in the endgame.
All that said, you can go a long way if you just do something simple: count the "weight" (total value) of pieces that attack the King or squares near it, and scale this by the attacking side's material. Also give a penalty for damaging the King shelter. Tune the bonus/penalty until your program does not play into attacks blindly. But do not tune so high that it starts sacrificing material for unsound attacks - that is entertaining to watch but will lose games.
--Jon
-
jdart
- Posts: 4361
- Joined: Fri Mar 10, 2006 5:23 am
- Location: http://www.arasanchess.org
Re: king safety: hard positions for zurichess
I should mention, too that you do need to handle stacked attackers such as "Alekhine's Gun". This is commonly done by considering own rooks as transparent when calculating rank/file attacks, as well as as Queens being "transparent" when considering Bishop attacks.