Answers.Body: <p>Depth 19 refers to 19 plies, not 19 moves (which would be 2 plies each). So it's reasonable that Stockfish would only find the mate shortly after depth 19, since 10.Qh8# is the 19th ply from the starting position you posted.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-26T01:41:45.293Z
Answers.Text: Indeed, once Stockfish reaches depth 20 its evaluation jumps.
Answers.UserDisplayName: Allure
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-26T06:01:41.953Z
Answers.Text: Oh okay thanks for your answer, which confirms that something was off with what I thought was the reason.
Answers.UserDisplayName: user21820
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-25T21:27:40.567Z
Answers.LastActivityDate: 2020-05-25T21:53:56.290Z
Answers.LastEditDate: 2020-05-25T21:53:56.290Z
Answers.UserDisplayName: Inertial Ignorance
Body: <p><a href="https://lichess.org/analysis/r1b2r2/5pk1/pq2p3/1p5Q/3p1P2/P2Rn1NP/1P4P1/7K%20w%20-%20-%200%2028" rel="nofollow noreferrer">Stockfish 10+ at depth 19 evaluated this position as a draw</a>:</p>
  
  <pre><code>[Title "White to play and mate in 10"]
  [FEN "r1b2r2/5pk1/pq2p3/1p5Q/3p1P2/P2Rn1NP/1P4P1/7K w - - 0 28"]
  </code></pre>
  
  <p>However, it is actually checkmate in 10! I understand that Stockfish prunes the search tree heavily, which can (in theory) result in such errors in evaluation. But this is the first time (in practice) that I have seen a non-contrived position (it came from a variant line of an actual game that I was exploring with Stockfish) with a completely wrong evaluation. Can anyone who is very familiar with the Stockfish code provide an explanation of the main factors here? Is it simply that there were too many quiescent moves? I count only 5 moves that are not a check or a forced move (i.e. the only move that does not result in mate-in-3) or a capture, and these 5 are the moves that I as a human player would consider as quiescent (even if I ignore the great king danger). Am I missing some other reason here?</p>
  
  <p>The principal variation is:</p>
  
  <pre><code>[Title "White checkmates in 10"]
  [FEN "r1b2r2/5pk1/pq2p3/1p5Q/3p1P2/P2Rn1NP/1P4P1/7K w - - 0 0"]
  
  1. Qg5+ Kh7 2. Nh5 Nf5 3. Nf6+ Kh8 4. Kh2 e5
  5. Rg3 Qxf6 6. Qxf6+ Kh7 7. Rg5 d3 8. Rh5+ Nh6
  9. Qxh6+ Kg8 10. Qh8#
  </code></pre>
  
  <p>Stockfish 10+ at depth 19 evaluates it as draw until <code>29. Nh5</code>. After the next move <code>Nf5</code>, Stockfish thought it was +7.5. After the next move <code>Nf6+</code> Stockfish knew it was game over.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-25T10:52:41.613Z
Comments.Text: At which point in the winning line does stockfish realize that it's winning for white? Also, it may be a good idea to give the actual mating variation.
Comments.UserDisplayName: Scounged
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-25T11:14:58.470Z
Comments.Text: @Scounged: Added! I realize I miscounted the number of moves to checkmate by 1. =P
Comments.UserDisplayName: user21820
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-25T12:23:27.713Z
Comments.Text: stockfish reaches depth 19 in 20k nodes in this position. Don't expect it to mean anything... It finds the actual mate in a fraction of a second. Depth is not a meaningful metric
Comments.UserDisplayName: Sopel
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-25T12:30:10.697Z
Comments.Text: @Sopel: Are you saying that the Stockfish on Lichess is not full Stockfish? Or did you have to change some setting to get it to search for checkmate?
Comments.UserDisplayName: user21820
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-25T14:32:35.277Z
Comments.Text: stockfish on lichess by default searches to depth ~20. You need to hit the small "+" button to search further. It's also just a port of stockfish to WASM so it's slower than a desktop version.
Comments.UserDisplayName: Sopel
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-25T14:40:04.653Z
Comments.Text: @Sopel: I know that clicking the "+" button extends the search, but I was curious to know why it pruned the correct line off. (I know enough to know that "depth 19" means it decided to search some lines to depth 19.) I think the 'default' depth depends on your computer+browser speed. It just seems odd to me, but I can't quite put a finger on why, and I was hoping there is an expert on Stockfish that can shed some light on this.
Comments.UserDisplayName: user21820
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-25T15:25:12.663Z
Comments.Text: the default depth is hardcoded in lichess
Comments.UserDisplayName: Sopel
Tags: <checkmate><stockfish><evaluation><puzzles>
Title: Mate-in-10 that Stockfish missed!
ThreadText: # Mate-in-10 that Stockfish missed!
  
  (Asked by: username_0 on 2020-05-25)
  
  [Stockfish 10+ at depth 19 evaluated this position as a draw](https://lichess.org/analysis/r1b2r2/5pk1/pq2p3/1p5Q/3p1P2/P2Rn1NP/1P4P1/7K%20w%20-%20-%200%2028):
  
  ```
  [Title "White to play and mate in 10"]
  [FEN "r1b2r2/5pk1/pq2p3/1p5Q/3p1P2/P2Rn1NP/1P4P1/7K w - - 0 28"]
  
  ```
  
  However, it is actually checkmate in 10! I understand that Stockfish prunes the search tree heavily, which can (in theory) result in such errors in evaluation. But this is the first time (in practice) that I have seen a non-contrived position (it came from a variant line of an actual game that I was exploring with Stockfish) with a completely wrong evaluation. Can anyone who is very familiar with the Stockfish code provide an explanation of the main factors here? Is it simply that there were too many quiescent moves? I count only 5 moves that are not a check or a forced move (i.e. the only move that does not result in mate-in-3) or a capture, and these 5 are the moves that I as a human player would consider as quiescent (even if I ignore the great king danger). Am I missing some other reason here?
  
  The principal variation is:
  
  ```
  [Title "White checkmates in 10"]
  [FEN "r1b2r2/5pk1/pq2p3/1p5Q/3p1P2/P2Rn1NP/1P4P1/7K w - - 0 0"]
  
  1. Qg5+ Kh7 2. Nh5 Nf5 3. Nf6+ Kh8 4. Kh2 e5
  5. Rg3 Qxf6 6. Qxf6+ Kh7 7. Rg5 d3 8. Rh5+ Nh6
  9. Qxh6+ Kg8 10. Qh8#
  
  ```
  
  Stockfish 10+ at depth 19 evaluates it as draw until `29. Nh5`. After the next move `Nf5`, Stockfish thought it was +7.5. After the next move `Nf6+` Stockfish knew it was game over.
  
  **Tags:** checkmate, stockfish, evaluation, puzzles
  
  > **Comments:**
  > **username_1**: At which point in the winning line does stockfish realize that it's winning for white? Also, it may be a good idea to give the actual mating variation.  
  > **username_0**: @username_1: Added! I realize I miscounted the number of moves to checkmate by 1. =P  
  > **username_2**: stockfish reaches depth 19 in 20k nodes in this position. Don't expect it to mean anything... It finds the actual mate in a fraction of a second. Depth is not a meaningful metric  
  > **username_0**: @username_2: Are you saying that the Stockfish on Lichess is not full Stockfish? Or did you have to change some setting to get it to search for checkmate?  
  > **username_2**: stockfish on lichess by default searches to depth ~20. You need to hit the small "+" button to search further. It's also just a port of stockfish to WASM so it's slower than a desktop version.  
  > **username_0**: @username_2: I know that clicking the "+" button extends the search, but I was curious to know why it pruned the correct line off. (I know enough to know that "depth 19" means it decided to search some lines to depth 19.) I think the 'default' depth depends on your computer+browser speed. It just seems odd to me, but I can't quite put a finger on why, and I was hoping there is an expert on Stockfish that can shed some light on this.  
  > **username_2**: the default depth is hardcoded in lichess  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2020-05-25. Score: 9 | Accepted answer
  
  Depth 19 refers to 19 plies, not 19 moves (which would be 2 plies each). So it's reasonable that Stockfish would only find the mate shortly after depth 19, since 10.Qh8# is the 19th ply from the starting position you posted.
  
  > **Comments:**
  > **username_4**: Indeed, once Stockfish reaches depth 20 its evaluation jumps.  
  > **username_0**: Oh okay thanks for your answer, which confirms that something was off with what I thought was the reason.  
  
  ---
  
  