Answers.Body: <p>Chess engines will always try to extend the search by a few moves, so a position is only evaluated if it is considered &quot;quiet&quot;. This is called <a href="https://www.chessprogramming.org/Quiescence_Search" rel="noreferrer">Quiescence Search</a>, and the problem you describe that it is trying to prevent is called the &quot;Horizon effect&quot;.</p>
  <p>So before evaluating a position, if there are captures, checks and so on in the position, then the search is first extended by those moves.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-22T17:00:09.190Z
Answers.Text: Due to the Halting Problem it seems like a weakness whereby one could detain a chess engine by pursuing a line that is very "noisy" for many moves, thereby making it waste time getting into deeper plys.
Answers.UserDisplayName: Michael
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-22T17:46:12.943Z
Answers.Text: One might suspect that "very noisy" situations often (seem to?) resolve fairly quickly?
Answers.UserDisplayName: paul garrett
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-22T17:47:13.770Z
Answers.Text: Well time spent is an issue (that page I linked to says that 50% - 90% of total nodes searched are nodes added for quiescence search!) but I have no idea why the halting problem would matter. It always halts, the game is finite.
Answers.UserDisplayName: RemcoGerlich
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-23T02:35:32.780Z
Answers.Text: This answer could be improved by including the definitions of "quiet" and the "Horizon effect" in the answer itself, since those are a core part of the answer.
Answers.UserDisplayName: NotThatGuy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-23T12:38:34.793Z
Answers.Text: It has nothing really to do with the halting problem. As for trying to "confuse" the chess engine, to properly do that you would need to be able to match it's calculating depth...
Answers.UserDisplayName: Erik
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-21T20:21:53.163Z
Answers.LastActivityDate: 2020-08-21T20:21:53.163Z
Answers.UserDisplayName: RemcoGerlich
Body: <p>I read about the chess engine algorithms and came up with a question. If, for example  roughly all (disregarding alpha-beta pruning) possible 20 moves variations are calculated, why does a chess engine not consider a piece exchange on move 20 winning? It seems to me that to an evaluation function the final position will seem like one player is just up a piece. How do they solve this problem?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-08-22T05:35:49.527Z
Comments.Text: Note that when an engine says it's at some depth (say depth 25), this includes the quiescence search Remco mentioned in his answer. An engine at depth 25 could still be going only 25 plies deep for certain variations, while at the same time 30 plies deep for others.
Comments.UserDisplayName: Inertial Ignorance
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-08-22T15:48:35.373Z
Comments.Text: You may be interested in [this detailed explanation about the basics of how a general chess engine works](https://chess.stackexchange.com/a/29842/9192).
Comments.UserDisplayName: user21820
Tags: <engines><chess-algorithms>
Title: Why does a chess engine not get excited about a piece exchange at the end of its analysis depth?
ThreadText: # Why does a chess engine not get excited about a piece exchange at the end of its analysis depth?
  
  (Asked by: username_0 on 2020-08-21)
  
  I read about the chess engine algorithms and came up with a question. If, for example roughly all (disregarding alpha-beta pruning) possible 20 moves variations are calculated, why does a chess engine not consider a piece exchange on move 20 winning? It seems to me that to an evaluation function the final position will seem like one player is just up a piece. How do they solve this problem?
  
  **Tags:** engines, chess-algorithms
  
  > **Comments:**
  > **username_1**: Note that when an engine says it's at some depth (say depth 25), this includes the quiescence search Remco mentioned in his answer. An engine at depth 25 could still be going only 25 plies deep for certain variations, while at the same time 30 plies deep for others.  
  > **username_2**: You may be interested in [this detailed explanation about the basics of how a general chess engine works](https://chess.stackexchange.com/a/29842/9192).  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2020-08-21. Score: 27 | Accepted answer
  
  Chess engines will always try to extend the search by a few moves, so a position is only evaluated if it is considered "quiet". This is called [Quiescence Search](https://www.chessprogramming.org/Quiescence_Search), and the problem you describe that it is trying to prevent is called the "Horizon effect".
  
  So before evaluating a position, if there are captures, checks and so on in the position, then the search is first extended by those moves.
  
  > **Comments:**
  > **username_4**: Due to the Halting Problem it seems like a weakness whereby one could detain a chess engine by pursuing a line that is very "noisy" for many moves, thereby making it waste time getting into deeper plys.  
  > **username_5**: One might suspect that "very noisy" situations often (seem to?) resolve fairly quickly?  
  > **username_3**: Well time spent is an issue (that page I linked to says that 50% - 90% of total nodes searched are nodes added for quiescence search!) but I have no idea why the halting problem would matter. It always halts, the game is finite.  
  > **username_6**: This answer could be improved by including the definitions of "quiet" and the "Horizon effect" in the answer itself, since those are a core part of the answer.  
  > **username_7**: It has nothing really to do with the halting problem. As for trying to "confuse" the chess engine, to properly do that you would need to be able to match it's calculating depth...  
  
  ---
  
  