TheBlackPlague / StockNemo

A C# Chess Engine Finding Good Moves.
GNU Lesser General Public License v3.0
62 stars 7 forks source link

Misses tactic at depth 14, finds it at depth 15. #33

Closed TheBlackPlague closed 2 years ago

TheBlackPlague commented 2 years ago

In the game played vs. simpleEval on Lichess, StockNemo missed a critical tactic (possibly only a few ply deep) due to the aggressive pruning from the latest updates:

[Event "Casual Bullet game"]
[Site "https://lichess.org/lTyfwOgc"]
[Date "2022.07.19"]
[White "StockNemo"]
[Black "simpleEval"]
[Result "0-1"]
[UTCDate "2022.07.19"]
[UTCTime "17:46:14"]
[WhiteElo "2143"]
[BlackElo "2068"]
[WhiteTitle "BOT"]
[BlackTitle "BOT"]
[Variant "Standard"]
[TimeControl "60+2"]
[ECO "E60"]
[Opening "King's Indian Defense: Fianchetto Variation, Immediate Fianchetto"]
[Termination "Normal"]
[Annotator "lichess.org"]

1. d4 Nf6 2. c4 g6 3. g3 { E60 King's Indian Defense: Fianchetto Variation, Immediate Fianchetto } c5 4. d5 b5 5. cxb5 a6 
6. bxa6 d6 7. Nc3 Nxa6 8. Nf3 h6 9. Bg2 Bg7 10. O-O O-O 
11. e4 Nh7 12. Be3 Nf6 13. h3 g5 14. a3 Rb8 15. Qc2 e6 
16. Rad1 exd5 17. exd5 Nc7 18. Nd2 Ba6 19. Rfe1 Nd7 20. a4 Ne5 
21. Nf3 Nxf3+ 22. Bxf3 Bc4 23. Rd2 f5 24. Ne2 Bxe2 25. Rdxe2 Rxb2 
26. Qd1 Rb4 27. Bc1 Bc3 28. Bd2 Bxd2 29. Rxd2 Qd7 30. a5 g4 
31. hxg4 fxg4 32. Bg2 Qf5 33. Qa1 h5 34. a6 h4 35. gxh4 Qh7 
36. Rde2 Qxh4 37. Qa5 g3 38. fxg3 Qxg3 39. Re3 Rf3 40. Qa2 Rxe3 
41. Rf1 Rh4 42. a7 Qh2+ 43. Kf2 Ree4 44. a8=Q+ Nxa8 45. Qd2 Rhg4 
46. Qe3 Qxg2+ 47. Ke1 Rxe3+ 48. Kd1 Qxf1+ 49. Kd2 Qe2+ 50. Kc1 Rg1# { Black wins by checkmate. } 0-1

The issue happens in 37. Qa5. It's a major blunder with a CP loss of 800, according to Stockfish, and was game losing. The correct move is 37. a7.

According to a manual search done on StockNemo for the FEN, 5rk1/2n5/P2p4/2pP4/1r4pq/8/4RPB1/Q3R1K1 w - - 0 37:

position fen 5rk1/2n5/P2p4/2pP4/1r4pq/8/4RPB1/Q3R1K1 w - - 0 37
go depth 16
info depth 1 score cp 199 nodes 88 nps 4631 pv a6a7
info depth 2 score cp 165 nodes 859 nps 45210 pv a6a7 b4f4
info depth 3 score cp 163 nodes 2938 nps 146900 pv a6a7 b4f4 a1b2
info depth 4 score cp 149 nodes 4569 nps 228450 pv a6a7 b4d4 e1d1 f8f4
info depth 5 score cp 165 nodes 14710 nps 612916 pv a1a5 f8c8 a6a7 b4d4 a7a8q
info depth 6 score cp 148 nodes 32890 nps 1134138 pv a6a7 b4d4 a1a5 f8c8
info depth 7 score cp 148 nodes 79774 nps 1813045 pv a6a7 b4d4 a1a5 f8c8 a5b6 c7d5 b6d6
info depth 8 score cp 177 nodes 301763 nps 2624026 pv a6a7 g4g3 f2g3 h4g3 a1a5 b4b7 e2e7 f8f2
info depth 9 score cp 177 nodes 471354 nps 2740430 pv a1a5 f8c8 a6a7 g4g3 f2g3 h4g3 e2e3 g3g5 a5a2
info depth 10 score cp 143 nodes 663341 nps 2834790 pv a1a5 f8c8 a6a7 g4g3 f2g3 h4g3 e2e3 g3g5 a5a2 b4f4
info depth 11 score cp 193 nodes 1006560 nps 2892414 pv a1a5 f8c8 a6a7 b4b7 e2e7 c8f8 e7c7 h4f2 g1h1 b7c7
info depth 12 score cp 176 nodes 2183785 nps 2991486 pv a1a5 c7a8 a6a7 a8b6 a5a2 b4f4 a2b1 b6c4 b1g6 g8h8 e1f1 f8d8
info depth 13 score cp 179 nodes 3450351 nps 2959134 pv a1a5 c7a8 a6a7 g4g3 f2g3 h4g3 a5a2 b4f4 e2e8 a8b6 e8f8 f4f8 e1e7
info depth 14 score cp 172 nodes 4600382 nps 2947073 pv a1a5 c7a8 a6a7 g4g3 f2g3 h4g3 e1f1 f8f1 g1f1 b4b1 e2e1 g3d3 f1g1 a8b6
info depth 15 score cp 133 nodes 10825238 nps 2909228 pv a6a7 g4g3 f2g3 h4g3 e1f1 f8a8 e2e7 c7d5 a1e1 g3g6 e1e6 g6e6 e7e6 d5c7 e6g6
info depth 16 score cp 136 nodes 15586150 nps 2922585 pv a6a7 g4g3 f2g3 h4g3 e1f1 f8a8 e2e7 c7d5 a1e1 g3g6 e1e6 g6e6 e7e6 d5c7 e6g6 g8h7
bestmove a6a7

It seems StockNemo finds the correct move at depth 15 and onwards but does not at depth 14. Ideally, these moves should be found earlier (possibly at the tactical ply), but they're sometimes missed due to pruning.

TheBlackPlague commented 2 years ago

This issue seems to be resolved by #43. Now a6a7 is considered the best move at depth 13 (2 plies before where it was found previously).

However, since this may have just subsided the issue to a lower depth, I'll leave this issue open for now.

position fen 5rk1/2n5/P2p4/2pP4/1r4pq/8/4RPB1/Q3R1K1 w - - 0 37
go depth 16
info depth 1 score cp 199 nodes 84 nps 4666 pv a6a7
info depth 2 score cp 165 nodes 281 nps 15611 pv a6a7 b4f4
info depth 3 score cp 163 nodes 972 nps 51157 pv a6a7 b4f4 a1b2
info depth 4 score cp 149 nodes 3157 nps 166157 pv a6a7 b4d4 e1d1 f8f4
info depth 5 score cp 174 nodes 9548 nps 454666 pv a1a5 f8c8 e2e7 b4b5 a5a1
info depth 6 score cp 148 nodes 20421 nps 850875 pv a6a7 b4d4 a1a5 f8c8 a5b6 c7d5
info depth 7 score cp 154 nodes 37457 nps 1291620 pv a6a7 b4d4 a1a5 f8c8 a5a2 g4g3 a2b3
info depth 8 score cp 160 nodes 83549 nps 1989261 pv a6a7 b4f4 a1a5 f4f7 a5d2 f7f4 d2e3 c7b5
info depth 9 score cp 177 nodes 163993 nps 2603063 pv a1a5 f8c8 a6a7 g4g3 f2g3 h4g3 e2e3 g3g5 a5a2
info depth 10 score cp 161 nodes 317298 nps 2993377 pv a1a5 f8c8 a6a7 g4g3 f2g3 h4g3 e2e7 b4d4 e1e3 d4d1
info depth 11 score cp 195 nodes 462087 nps 3186807 pv a1a5 f8c8 a6a7 g4g3 f2g3 h4g3 e2e7 b4f4 a5d2 c7b5 d2e2
info depth 12 score cp 171 nodes 628133 nps 3305963 pv a1a5 f8c8 a6a7 g4g3 f2g3 h4g3 e1d1 g3g7 a5a3 b4d4 d1d4 g7d4
info depth 13 score cp 101 nodes 2088447 nps 3588396 pv a6a7 g4g3 f2g3 h4g3 e2e3 g3f2 g1h1 b4b2 e1g1 f2e3 a1b2 f8f2 b2b8
info depth 14 score cp 109 nodes 2540595 nps 3613933 pv a6a7 g4g3 f2g3 h4g3 e2e3 g3f2 g1h1 b4b2 e1g1 f2e3 a1b2 f8f2 b2b8 c7e8
info depth 15 score cp 160 nodes 8766836 nps 3494155 pv a6a7 b4f4 e1f1 c5c4 a1b1 g8h8 b1b2 h8g8 e2e3 h4g5 b2b8 f4f7 e3e1 c4c3 e1d1
info depth 16 score cp 131 nodes 12637203 nps 3468900 pv a6a7 b4f4 e1f1 f4f5 a1a4 f5h5 f1d1 h4h2 g1f1 h2g3 a4e4 h5f5 e4c2 g3h2 e2e7 f5f2
bestmove a6a7
TheBlackPlague commented 2 years ago

After #53:

position fen 5rk1/2n5/P2p4/2pP4/1r4pq/8/4RPB1/Q3R1K1 w - - 0 37
go
info depth 1 score cp 179 nodes 80 nps 3200 pv a6a7
info depth 2 score cp 157 nodes 272 nps 10461 pv a6a7 b4b3
info depth 3 score cp 184 nodes 698 nps 26846 pv a6a7 b4b3 a1c1
info depth 4 score cp 163 nodes 1892 nps 70074 pv a6a7 g4g3 e2e7 g3f2
info depth 5 score cp 201 nodes 7315 nps 243833 pv a1a5 h4h7 a6a7 b4b5 a5d2
info depth 6 score cp 256 nodes 12000 nps 363636 pv a1a5 c7b5 a6a7 b5a7 a5a7 b4f4
info depth 7 score cp 203 nodes 19383 nps 523864 pv a1a5 g4g3 f2g3 h4d4 g1h2 c7d5 a6a7 b4b3
info depth 8 score cp 191 nodes 27955 nps 665595 pv a1a5 g4g3 f2g3 h4d4 g1h2 d4h8 g2h3 c7d5 a6a7 h8f6
info depth 9 score cp 192 nodes 45915 nps 866320 pv a1a5 c7a6 a5a6 g4g3 f2g3 h4g3 e1f1 f8f1 g1f1 g8g7
info depth 10 score cp 193 nodes 69111 nps 1016338 pv a1a5 c7a6 a5a6 g4g3 f2g3 h4g3 a6a7 b4h4 a7d7 h4h2
info depth 11 score cp 121 nodes 163013 nps 1283566 pv a1a5 c7a6 a5a6 g4g3 f2g3 h4g3 e2e4 b4e4 e1e4 f8f2 a6c8
info depth 12 score cp 119 nodes 509507 nps 1489786 pv a6a7 g4g3 f2g3 h4g3 e1f1 b4f4 f1f4 g3f4 a1a5 f4c1 g1h2 c1f4 h2h1 c7e8
info depth 13 score cp 132 nodes 1244954 nps 1562050 pv a1c3 b4f4 c3c2 h4g5 e2e7 f4f7 e7f7 f8f7 c2d3 g8g7 d3c3 g5f6 c3f6 g7f6 a6a7
info depth 14 score cp 104 nodes 1760958 nps 1592186 pv a1c3 b4f4 c3c2 c7a6 c2g6 g8h8 g6d6 f4f2 d6e5 f2f6 e1f1 g4g3 f1f6 h4f6 e5g3 a6b4
info depth 15 score cp 103 nodes 2933552 nps 1610956 pv a6a7 b4f4 a1b1 f4f2 b1e4 g8g7 e4e7 h4e7 e2e7 f2f7 e1e4 g4g3 e4e3 g7f6 e7f7 f6f7 e3f3 f7e7 f3f8
info depth 16 score cp 140 nodes 4859282 nps 1636672 pv a6a7 b4f4 e1f1 f4f7 a1a4 g8h8 a4c2 h8g7 c2c3 g7g8 e2e4 f7f2 e4g4 h4g4 f1f2 f8f2 g1f2 g8f7
info depth 17 score cp 137 nodes 6807163 nps 1639885 pv a6a7 b4f4 e1f1 f4f7 a1a4 g8h8 a4c2 f7g7 c2d3 g7f7 d3e3 h8g7 e3c3 g7g8 e2e4 f7f2 f1f2 h4f2
info depth 18 score cp 137 nodes 13412027 nps 1648074 pv a6a7 b4f4 e1f1 f4f7 a1a4 g8h8 a4a5 h8g8 a5a3 g8g7 a3b2 g7g8 b2b1 h4h6 e2e4 h6h4 b1d1 f7f2 f1f2
info depth 19 score cp 144 nodes 17159853 nps 1664389 pv a6a7 b4f4 e1f1 f4f7 a1a4 g8h8 a4a5 h8g8 a5a3 g8g7 a3b2 g7g8 b2b3 h4g5 b3d3 f8a8 e2a2 g8g7 d3b3 a8e8
info depth 20 score cp 149 nodes 31866941 nps 1675267 pv a6a7 b4f4 e1f1 f4f7 a1a4 g8h8 a4c4 f8a8 c4c3 f7g7 c3b2 a8g8 b2b8 h4g5 e2e3 g7f7 e3g3 h8h7 f1e1 g5f4 b8b2

Past depth 11, it looks like StockNemo no longer blunders a1a5. This guarantees this issue is fixed.