Positional Test Position

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

User avatar
Leto
Posts: 2071
Joined: Thu May 04, 2006 3:40 am
Location: Dune

Positional Test Position

Post by Leto »

1. c4 e5 2. Nc3 Nf6 3. g3 Bb4 4. Bg2 O-O 5. Nf3 Nc6 6. Nd5 e4 7. Nh4 d6 8. Nxb4
Nxb4 9. a3 Nc6 10. d3 Re8 11. O-O h6 12. dxe4 Nxe4 13. Qc2 Nd4

[D]r1bqr1k1/ppp2pp1/3p3p/8/2Pnn2N/P5P1/1PQ1PPBP/R1B2RK1 w - - 0 14

Does your engine think this is okay for black or does it think white's winning? The latest Stockfish thinks this is okay for black, and Houdini 4 Tactical also thinks it's okay:


Analysis by Houdini 4 x64 8T:

13...Nd4 14.Qd3 Nxe2+ 15.Qxe2 Nxg3 16.Qxe8+ Qxe8 17.hxg3 Qe2 18.b3 Qd3 19.Re1 Bd7 20.Bxb7 Re8 21.Rxe8+ Bxe8 22.Be3 Qxb3 23.Bg2 Bd7 24.Nf3 Qb2 25.Bd4 Qc2 26.Be3 Qb2 27.Bd4
= (0.00) Depth: 30/73 00:47:51 36082MN, tb=11

Komodo 8 on the other hand immediately sees that white is ahead by almost a pawn. I had them play against each other with K8 with white and SF with black and eventually SF agreed that Komodo 8 was right.

13... Nd4 14. Qd3 Nxe2+ 15. Qxe2 Nxg3 16. Qxe8+ Qxe8 17. hxg3 Qe2 18. b3 Qd3 19. Be3 Qxb3
20. Nf3 Qa4 21. Rfd1 Bd7 22. c5 dxc5 23. Ne5 Bb5 24. Bd5 Kh8 25. Bxf7 b6 26.
Rd2 g5 27. f4 Kg7 28. Rf2 g4 29. Be6 Rd8 30. Kh2 Be8 31. Bxg4 h5
32. Bf3 Qb3 33. Bc1 c4 34. f5 and now SF shows white with over two pawn advantage.
Dan Astrachan
Posts: 134
Joined: Fri May 28, 2010 11:07 am

Re: Positional Test Position

Post by Dan Astrachan »

After about an hour of thinking on my machine, Stockfish doesn't see anything special for White:


Stockfish_14090421_x64_modern
40/56 59:32 5 668 546k 1 587k +0,12

[pgn][FEN "r1bqr1k1/ppp2pp1/3p3p/8/2Pnn2N/P5P1/1PQ1PPBP/R1B2RK1 w - - 0 14"] 14.Qd3 Nxe2+ 15.Qxe2 Nxg3 16.Qxe8+ Qxe8 17.hxg3 Qe2 18.b3 Qc2 19.Re1 Bd7 20.Be3 Qxb3 21.Reb1 Qc3 22.Rc1 Qa5 23.Bxb7 Rb8 24.Bg2 c5 25.Nf3 Be6 26.a4 g5 27.Nd2 f5 28.Ra3 Rb4 29.Rd3 Qc7 30.a5 Kg7 31.Re1 Bf7 32.f4 g4 33.a6 Ra4[/pgn]
Computer used: Intel Core i7 875K @ 2.93GH, 4 cores, 12 Gb of RAM
BeyondCritics
Posts: 396
Joined: Sat May 05, 2012 2:48 pm
Full name: Oliver Roese

Re: Positional Test Position

Post by BeyondCritics »

I agree, it is a difficult test position that can distinguish stockfish from komodo currently. IMHO more tasty would have been to skip the forced move sequence and start from here
[d]r1b3k1/ppp2pp1/3p3p/8/2P4N/P5P1/1P2qPB1/R1B2RK1 w - - 1 18

White will loose a pawn soon and then the formal material balance is even.
Stockfish believes the position is balanced, komodo believes white is to be preferred and shows a convincing pv, leading to this position:

[d]r6k/p1p2Bp1/1p5p/1bp1N3/q7/P3B1P1/3R1P2/R5K1 b - - 1 26
Suddenly both engines recommend 26..g5?(?) as if that would be completely normal.
They then follow up with 27.f4! and black is busted soon. However there must be better attempts to defend, e.g. 26..Be8!? and no mate attack is there.

So we can safely conclude that unbalanced positions are difficult.
Uri Blass
Posts: 10279
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Positional Test Position

Post by Uri Blass »

Stockfish does not evaluate king safety when the opponent has no queen so of course it does not try to defend against mate attack if it does not see the final mate by search.
Vinvin
Posts: 5228
Joined: Thu Mar 09, 2006 9:40 am
Full name: Vincent Lejeune

Re: Positional Test Position

Post by Vinvin »

Uri Blass wrote:Stockfish does not evaluate king safety when the opponent has no queen so of course it does not try to defend against mate attack if it does not see the final mate by search.
Instead of "queen" SF should evaluate strength of opponent pieces remaining (2B+N+R considered less dangerous than a queen ??) and/or squares attacked around the king : http://www.top-5000.nl/authors/rebel/ch ... ING_SAFETY
Uri Blass
Posts: 10279
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Positional Test Position

Post by Uri Blass »

Vinvin wrote:
Uri Blass wrote:Stockfish does not evaluate king safety when the opponent has no queen so of course it does not try to defend against mate attack if it does not see the final mate by search.
Instead of "queen" SF should evaluate strength of opponent pieces remaining (2B+N+R considered less dangerous than a queen ??) and/or squares attacked around the king : http://www.top-5000.nl/authors/rebel/ch ... ING_SAFETY
From your link:

REMARKS :
King Safety in REBEL is not done when the opponent has no Queen

Same is also in stockfish.

Note that I do not think that it is a good idea not to evaluate king safety when the opponent has no queen but you need to find the right code to get improvement in stockfish.

removing it probably lose something near 1 elo based on fixed number of games(may be a statistical error but all tests suggest the same direction so I prefered not to spend time on SPRT(-3,1)) so probably it is better to remove the condition and fix stockfish king safety evaluation.
Joerg Oster
Posts: 937
Joined: Fri Mar 10, 2006 4:29 pm
Location: Germany

Re: Positional Test Position

Post by Joerg Oster »

BeyondCritics wrote:I agree, it is a difficult test position that can distinguish stockfish from komodo currently. IMHO more tasty would have been to skip the forced move sequence and start from here
[d]r1b3k1/ppp2pp1/3p3p/8/2P4N/P5P1/1P2qPB1/R1B2RK1 w - - 1 18

White will loose a pawn soon and then the formal material balance is even.
Stockfish believes the position is balanced, komodo believes white is to be preferred and shows a convincing pv, leading to this position:

[d]r6k/p1p2Bp1/1p5p/1bp1N3/q7/P3B1P1/3R1P2/R5K1 b - - 1 26
Suddenly both engines recommend 26..g5?(?) as if that would be completely normal.
They then follow up with 27.f4! and black is busted soon. However there must be better attempts to defend, e.g. 26..Be8!? and no mate attack is there.

So we can safely conclude that unbalanced positions are difficult.
Yes, Be8 in the second position seems to be better.
A slightly changed Stockfish, which does a full king-safety eval even when there is no queen but sufficient mating material, gives this:

Code: Select all

 +---+---+---+---+---+---+---+---+
 | r |   |   |   |   |   |   | k |
 +---+---+---+---+---+---+---+---+
 | p |   | p |   |   | B | p |   |
 +---+---+---+---+---+---+---+---+
 |   | p |   |   |   |   |   | p |
 +---+---+---+---+---+---+---+---+
 |   | b | p |   | N |   |   |   |
 +---+---+---+---+---+---+---+---+
 | q |   |   |   |   |   |   |   |
 +---+---+---+---+---+---+---+---+
 | P |   |   |   | B |   | P |   |
 +---+---+---+---+---+---+---+---+
 |   |   |   | R |   | P |   |   |
 +---+---+---+---+---+---+---+---+
 | R |   |   |   |   |   | K |   |
 +---+---+---+---+---+---+---+---+

Fen: r6k/p1p2Bp1/1p5p/1bp1N3/q7/P3B1P1/3R1P2/R5K1 b - - 1 26
Key: 31CC49368C7504B6
Checkers: 
eval
      Eval term |    White    |    Black    |    Total    
                |   MG    EG  |   MG    EG  |   MG    EG  
----------------+-------------+-------------+-------------
       Material |   ---   --- |   ---   --- | -0.47 -0.88 
      Imbalance |   ---   --- |   ---   --- |  0.44  0.44 
          Pawns |   ---   --- |   ---   --- |  0.00 -0.16 
        Knights |  0.27  0.07 |  0.00  0.00 |  0.27  0.07 
        Bishops |  0.00 -0.12 |  0.00  0.00 |  0.00 -0.12 
          Rooks |  0.17  0.08 |  0.00  0.00 |  0.17  0.08 
         Queens |  0.00  0.00 |  0.00  0.00 |  0.00  0.00 
       Mobility |  0.76  1.45 |  0.44  0.76 |  0.32  0.69 
    King safety |  0.43 -0.06 |  0.16 -0.06 |  0.27  0.00 
        Threats |  0.00  0.00 |  0.06  0.15 | -0.06 -0.15 
   Passed pawns |  0.00  0.00 |  0.14  0.22 | -0.14 -0.22 
          Space |  0.00  0.00 |  0.00  0.00 |  0.00  0.00 
----------------+-------------+-------------+-------------
          Total |   ---   --- |   ---   --- |  0.80 -0.21 

Total Evaluation: 0.28 (white side)

go depth 17
info depth 1 seldepth 1 score cp 36 nodes 118 nps 19666 time 6 multipv 1 pv a4e4
info depth 2 seldepth 3 score cp 41 nodes 343 nps 49000 time 7 multipv 1 pv a4e4 e3f4
info depth 3 seldepth 3 score cp 62 nodes 627 nps 78375 time 8 multipv 1 pv a4e4 e3f4 g7g5
info depth 4 seldepth 5 score cp -28 nodes 1196 nps 132888 time 9 multipv 1 pv a4e4 e3f4 b5e2 f7g6
info depth 5 seldepth 6 score cp -22 nodes 4045 nps 252812 time 16 multipv 1 pv c5c4 e3d4 a8d8 e5g6 h8h7 a1b1
info depth 6 seldepth 7 score cp -10 nodes 6524 nps 326200 time 20 multipv 1 pv c5c4 e3d4 a8d8 d4c3 d8d2 c3d2
info depth 7 seldepth 10 score cp -25 nodes 9144 nps 397565 time 23 multipv 1 pv c5c4 e3d4 a8d8 a1b1 c7c5 d4c3 d8d2 c3d2
info depth 8 seldepth 11 score cp -44 nodes 47780 nps 955600 time 50 multipv 1 pv a4a5 a1b1 a8c8 d2d1 c7c6 e5g6 h8h7 d1d6 a5a3
info depth 9 seldepth 12 score cp -36 nodes 85604 nps 1172657 time 73 multipv 1 pv a4a5 a1b1 b5e8 f7d5 a8d8 b1b3 a5a4 d5c4 d8d6
info depth 10 seldepth 15 score cp -37 nodes 175427 nps 1392277 time 126 multipv 1 pv b5e8 f7d5 a8c8 f2f4 e8b5 d2b2 c8e8 b2h2 c7c6 d5f7 a4e4 f7e8 e4e3 g1h1 e3g3 e8c6 b5c6 e5c6
info depth 11 seldepth 16 score cp -32 nodes 207959 nps 1434200 time 145 multipv 1 pv b5e8 f7d5 a8c8 f2f4 e8b5 d2b2 c8e8 g1g2 c7c6 d5f3 h8g8 b2d2 e8f8
info depth 12 seldepth 23 score cp -33 nodes 391947 nps 1537047 time 255 multipv 1 pv b5e8 f7d5 a8c8 f2f4 e8b5 d2b2 c8e8 g1g2 c7c6 d5f3 h8g8 g2g1 e8f8 a1a2 f8d8
info depth 13 seldepth 23 score cp -27 nodes 639520 nps 1579061 time 405 multipv 1 pv b5e8 f7d5 a8c8 f2f4 e8b5 d2b2 c8e8 g1g2 c7c6 d5f3 h8g8 g2g1 e8f8 a1a2 f8d8
info depth 14 seldepth 23 score cp -27 nodes 1359793 nps 1592263 time 854 multipv 1 pv a4a5 a1d1 g7g5 d1b1 a5a4 b1a1 a4e4 e5g6 h8g7 f7d5 e4e8 d5a8 e8a8 d2b2 a8e8 g6e7
info depth 15 seldepth 24 score cp -22 nodes 2362965 nps 1591222 time 1485 multipv 1 pv a4a5 f7g6 b5a4 a1c1 a4e8 g6e4 a8b8 d2d3 e8b5 d3c3 h8g8 e4d5 g8h7 f2f4 b8d8 d5f3 a5a4 g1g2 h7g8
info depth 16 seldepth 24 score cp -22 nodes 2475832 nps 1592174 time 1555 multipv 1 pv a4a5 f7g6 b5a4 a1c1 a4e8 g6e4 a8b8 d2d3 e8b5 d3c3 h8g8 e4d5 g8h7 f2f4 b8d8 d5f3 a5a4 g1g2 h7g8
info depth 17 seldepth 27 score cp -35 nodes 3457406 nps 1592540 time 2171 multipv 1 pv b5e8 f7d5 a8c8 f2f4 c8b8 g1f2 b8d8 a1a2 d8d6 f2f3 e8g6 a2a1 g6e8 g3g4 d6f6 d5e4 f6d6 d2b2 h8g8 b2h2
info nodes 3457406 time 2171
bestmove b5e8 ponder f7d5
Jörg Oster
BeyondCritics
Posts: 396
Joined: Sat May 05, 2012 2:48 pm
Full name: Oliver Roese

Re: Positional Test Position

Post by BeyondCritics »

Hi Joerg,

quite interesting. Currently i have the stockfish source open in eclipse, trying to figure out the relevant source code position for this. Could you kindly help me to find it? What did you change in the source code?
Joerg Oster
Posts: 937
Joined: Fri Mar 10, 2006 4:29 pm
Location: Germany

Re: Positional Test Position

Post by Joerg Oster »

Hi Oliver,

take a look at init_eval_info() in evaluate.cpp.
You can find my change here: https://github.com/joergoster/Stockfish ... ing_safety
Hope this helps.
Jörg Oster
BeyondCritics
Posts: 396
Joined: Sat May 05, 2012 2:48 pm
Full name: Oliver Roese

Re: Positional Test Position

Post by BeyondCritics »

Yes it helped, thank you very much.
It maybe OT here, but i have another question: How do you stockfish developers test changes locally? Are there are any other established means beside the official testing queue?
Oliver