Answers.Body: <p>I call this complicated position something that is difficult for humans to analyze. But we have to classify it because one position can be complicated to a weaker player but not for a stronger player.</p>
  <p>I have tried your listed #2 and #3.</p>
  <p>Other ideas:</p>
  <ul>
  <li><p>Count the number of pins - pins can make the position difficult to evaluate, not just the absolute pin but other pins like a black queen will be captured by a white bishop if the black knight moves. The greater the number of pins the more complicated the position can become.</p>
  </li>
  <li><p>Presence of queen - when there is queen on the board it is difficult to evaluate because queen has a high mobility. Humans have to check every square the queen can move to get a complete analysis.</p>
  </li>
  <li><p>High number of legal moves for both sides - When position is dynamic humans have to evaluate most of them to not miss some tactics.</p>
  </li>
  <li><p>Presence of 2 or more important features - When humans are faced with 2 or more features like we have a good passer but our king is under attack, this would contribute to complications because we have to calculate defense and find ways to push our passer safely. We can use a weaker and stronger engine to evaluate such position. If score of weaker engine is high positive (it sees that the passer is good) while the score of stronger engine is just about equal (the king attack is deadly if not addressed) then this position can be complicated.</p>
  </li>
  <li><p>Use multipv greater than or equal to 2 - the presence of 2 or more good looking moves but only one is good can make the position complicated to a human. Use a weaker engine to generate 2 or more best moves, if it sees that there are 2 best moves and the stronger engine multipv analysis shows there is only 1 best move then this can be a candidate for a complicated position.</p>
  </li>
  <li><p>Try the stockfish engine, it has eval command where it will list static evaluations like passer, mobility and others. This static info together with the shallow, deep and multipv searches info can be used to calculate complicated position.</p>
  </li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-24T00:14:32.047Z
Answers.Text: These are very interesting ideas. In particular, I had not thought about using two or more engines and using their disagreement as a criterion for a complicated position. Regarding your first point about pins, instead of focusing on just pins, why not simply consider 'a piece x moving makes piece y vulnerable', which would capture pins as well. Finally, are there engines that use such criteria internally, e.g., to decide the depth of analysis in some variations?
Answers.UserDisplayName: chesskobra
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-23T23:34:08.103Z
Answers.LastActivityDate: 2022-07-25T23:57:44.970Z
Answers.LastEditDate: 2022-07-25T23:57:44.970Z
Answers.UserDisplayName: ferdy
Answers.Body: <p>Many engines (those with handcrafted eval at least) do this actually, but it might not be what you're looking for. The way they do it is via <a href="https://www.chessprogramming.org/Contempt_Factor" rel="nofollow noreferrer">contempt</a>, which uses the amount of material on the board remaining as a proxy for the complexity of the position. If the engine is playing a much-weaker opponent, then it's possible to increase contempt, which makes the engine avoid trades.</p>
  <p>Your methods don't work because:</p>
  <ul>
  <li>If the position's eval is changing from move to move, you need to search longer, not call the position complicated. For example if I play QxQ, the position's eval will change dramatically, and then it will change again after you recapture the queen.</li>
  <li>In the same way, &quot;multiple pieces attacked&quot; should not happen. If a position has multiple pieces attacked you need to search longer. This is known as <a href="https://www.chessprogramming.org/Quiescence_Search" rel="nofollow noreferrer">quiescence search</a> and is an acknowledgment of the fact that handcrafted evals only make sense if the position is &quot;quiet&quot;.</li>
  <li>King safety figures directly into the eval. If you want to prioritize king safety, you can simply increase the weight of king safety in the final evaluation. But viewed another way, this isn't really much of a free parameter - ultimately you need to pick the value that maximizes playing strength, not the value you think the engine should have.</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-25T00:08:54.133Z
Answers.Text: About your first point: I am not talking about static eval. Static eval would of course change after QxQ and then again after recapture. I am talking about fluctuation relative to the depth of analysis. About the other two points: I am not trying to make any engine stronger; I want to analyse games and extract positions that are complicated for humans, and I wondered if engines use some criteria to decide if a position requires deeper analysis, in which case that part of engine could be used to report complicated positions.
Answers.UserDisplayName: chesskobra
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-24T23:57:31.447Z
Answers.LastActivityDate: 2022-07-24T23:57:31.447Z
Answers.UserDisplayName: Allure
Body: <p>I would like to know what are some quantitative criteria to characterize chaotic or volatile positions, and if there are  engines or other programs that implement such criteria. One application I have in mind is extracting such positions from games for the purpose of calculation training. For example, finding positions in which one move leads to chaos on the board. Another would be to implement engine settings where the engine prefers to go into chaotic lines.</p>
  <p>I thought of some characterizations.</p>
  <ol>
  <li>Let us say we analyze the game tree to k plies to evaluate a given position P, and arrive at an evaluation eval(P,k). Now we look at the subtree in which all nodes have an evaluation close to eval(P,k). If this subtree is large, then the position would be difficult for humans to analyze. A drawback of this definition is that such a criterion may also include many quiet positions.</li>
  <li>Volatility: if the sequence eval(P,k), k = 0,1,2,... shows a lot of fluctuation, then it means the position is quite volatile.</li>
  <li>Both sides on attack, e.g., multiple pieces on both sides attacked, both kings vulnerable, etc.</li>
  </ol>
  <p>The second criterion is certainly interesting, but would also like to also incorporate something like 1 and 3. What are some other quantitative criteria?</p>
  
Tags: <engines>
Title: Are there chess programs that have a notion of a chaotic or volatile position?
ThreadText: # Are there chess programs that have a notion of a chaotic or volatile position?
  
  (Asked by: username_0 on 2022-07-20)
  
  I would like to know what are some quantitative criteria to characterize chaotic or volatile positions, and if there are engines or other programs that implement such criteria. One application I have in mind is extracting such positions from games for the purpose of calculation training. For example, finding positions in which one move leads to chaos on the board. Another would be to implement engine settings where the engine prefers to go into chaotic lines.
  
  I thought of some characterizations.
  
  1. Let us say we analyze the game tree to k plies to evaluate a given position P, and arrive at an evaluation eval(P,k). Now we look at the subtree in which all nodes have an evaluation close to eval(P,k). If this subtree is large, then the position would be difficult for humans to analyze. A drawback of this definition is that such a criterion may also include many quiet positions.
  2. Volatility: if the sequence eval(P,k), k = 0,1,2,... shows a lot of fluctuation, then it means the position is quite volatile.
  3. Both sides on attack, e.g., multiple pieces on both sides attacked, both kings vulnerable, etc.
  
  The second criterion is certainly interesting, but would also like to also incorporate something like 1 and 3. What are some other quantitative criteria?
  
  **Tags:** engines
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2022-07-23. Score: 4 | Accepted answer
  
  I call this complicated position something that is difficult for humans to analyze. But we have to classify it because one position can be complicated to a weaker player but not for a stronger player.
  
  I have tried your listed #2 and #3.
  
  Other ideas:
  
  * Count the number of pins - pins can make the position difficult to evaluate, not just the absolute pin but other pins like a black queen will be captured by a white bishop if the black knight moves. The greater the number of pins the more complicated the position can become.
  * Presence of queen - when there is queen on the board it is difficult to evaluate because queen has a high mobility. Humans have to check every square the queen can move to get a complete analysis.
  * High number of legal moves for both sides - When position is dynamic humans have to evaluate most of them to not miss some tactics.
  * Presence of 2 or more important features - When humans are faced with 2 or more features like we have a good passer but our king is under attack, this would contribute to complications because we have to calculate defense and find ways to push our passer safely. We can use a weaker and stronger engine to evaluate such position. If score of weaker engine is high positive (it sees that the passer is good) while the score of stronger engine is just about equal (the king attack is deadly if not addressed) then this position can be complicated.
  * Use multipv greater than or equal to 2 - the presence of 2 or more good looking moves but only one is good can make the position complicated to a human. Use a weaker engine to generate 2 or more best moves, if it sees that there are 2 best moves and the stronger engine multipv analysis shows there is only 1 best move then this can be a candidate for a complicated position.
  * Try the stockfish engine, it has eval command where it will list static evaluations like passer, mobility and others. This static info together with the shallow, deep and multipv searches info can be used to calculate complicated position.
  
  > **Comments:**
  > **username_0**: These are very interesting ideas. In particular, I had not thought about using two or more engines and using their disagreement as a criterion for a complicated position. Regarding your first point about pins, instead of focusing on just pins, why not simply consider 'a piece x moving makes piece y vulnerable', which would capture pins as well. Finally, are there engines that use such criteria internally, e.g., to decide the depth of analysis in some variations?  
  
  ---
  
  ### Answer by username_2 on 2022-07-24. Score: 0
  
  Many engines (those with handcrafted eval at least) do this actually, but it might not be what you're looking for. The way they do it is via [contempt](https://www.chessprogramming.org/Contempt_Factor), which uses the amount of material on the board remaining as a proxy for the complexity of the position. If the engine is playing a much-weaker opponent, then it's possible to increase contempt, which makes the engine avoid trades.
  
  Your methods don't work because:
  
  * If the position's eval is changing from move to move, you need to search longer, not call the position complicated. For example if I play QxQ, the position's eval will change dramatically, and then it will change again after you recapture the queen.
  * In the same way, "multiple pieces attacked" should not happen. If a position has multiple pieces attacked you need to search longer. This is known as [quiescence search](https://www.chessprogramming.org/Quiescence_Search) and is an acknowledgment of the fact that handcrafted evals only make sense if the position is "quiet".
  * King safety figures directly into the eval. If you want to prioritize king safety, you can simply increase the weight of king safety in the final evaluation. But viewed another way, this isn't really much of a free parameter - ultimately you need to pick the value that maximizes playing strength, not the value you think the engine should have.
  
  > **Comments:**
  > **username_0**: About your first point: I am not talking about static eval. Static eval would of course change after QxQ and then again after recapture. I am talking about fluctuation relative to the depth of analysis. About the other two points: I am not trying to make any engine stronger; I want to analyse games and extract positions that are complicated for humans, and I wondered if engines use some criteria to decide if a position requires deeper analysis, in which case that part of engine could be used to report complicated positions.  
  
  ---
  
  