Answers.Body: <p>It's easy enough to make the engine say it's 0.00 because of a 3-fold repetition. If you look at <a href="https://github.com/official-stockfish/Stockfish/blob/master/src/position.cpp#L1169" rel="nofollow noreferrer">the relevant part of Stockfish's code</a>, they are basically if statements that return a particular value if the condition is met. If you want to know if there's a 3-fold, you could add a <code>print &quot;this is a 3-fold&quot;</code> command and you'll have it. I'm hard-pressed to see why it matters, though. 0.00 is 0.00, regardless of whether it's insufficient material or fortress or 3-fold or whatever.</p>
  <p>It sounds like you want to know if the position is a dead draw or if it's still complex enough that you might be able to outplay your opponent. <em>This</em> is much harder to put in machine-understandable form. How would you define these things? There are certainly positions where engines have no trouble finding the best moves (and therefore all games end 1/2-1/2) while human games show it is very unbalanced.</p>
  <p>That said, there is some effort in the computer chess community to go beyond finding the simple &quot;best move&quot;. This started with <a href="https://www.chessprogramming.org/Contempt_Factor" rel="nofollow noreferrer">contempt</a> for handcrafted engines, which uses the material remaining on the board as a proxy for how complex the position is. The idea is that if you set contempt high, then the engine will play inferior moves as long as it keeps more material on the board, which leaves more scope to outplay a weaker opponent. Conversely if you set negative contempt, then the engine will simplify the position and shoot for a draw. That might be what you're looking for.</p>
  <p>Today's strongest engines are all neural-network based, for which contempt is more difficult to implement. Neural network eval return W/D/L, which is the probability of a win, draw, or loss from that position; there is no number for complexity (and probably cannot be since you'd need a very large training set with labelled &quot;complexity&quot; to get started). People are trying the so-called <em>draw score</em>, which turns draws from worth 0.5 points to, say, worth 0.4 points. This, it is hoped, makes the engine avoid draws - after all if one move leads to a three-fold while another leads to a 10% chance of win, 80% chance of draw, and 10% chance of loss then the second move has a higher expected score and becomes preferable. But even this does not work perfectly, since your engine might assess a position as drawn while the opponent sees a big advantage, see e.g. <a href="https://tcec-chess.com/#div=sf&amp;game=68&amp;season=21" rel="nofollow noreferrer">this game</a> where Leela saw 99.3% chance of draw on move 158, and still lost the game eventually.</p>
  <p>Ultimately you still need a way to measure if a position is &quot;dead&quot;, and a good way to do that doesn't exist (see <a href="https://chess.stackexchange.com/questions/22555/is-the-dead-position-problem-solvable">this question</a>). If you have a smart idea to measure how &quot;live&quot; the position is, you can probably get it published in a journal.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-11-23T13:39:54.123Z
Answers.Text: Ok, so technically is a trivial task, and wouldn't harm the engine performance. I edited my question in order to try to make it clearer why I think it'd be a desirable feature.
Answers.UserDisplayName: emdio
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-11-23T13:08:43.427Z
Answers.LastActivityDate: 2021-12-03T07:11:54.477Z
Answers.LastEditDate: 2021-12-03T07:11:54.477Z
Answers.UserDisplayName: Allure
Answers.Body: <p>There is in general no such thing as a simple &quot;this leads to threefold repetition&quot;. There may have been millions of different positions considered, and of those, if you select at each branch at your move the highest evaluation for you, and vice versa at the opponent's branch, that leads to a 0.00 evaluation that happened to come from a threefold.</p>
  <p>That doesn't mean that that threefold was <em>forced</em> in any way. Maybe there were a thousand different things you could have done instead but they were -0.1, or the opponent could have done but they were +0.1. And then were another thousand that <em>also</em> led to 0.00 but for different reasons: tablebase draw, stalemate...</p>
  <p>So, I guess engines could change the way they work, so that evaluation is not a fixed number but there can be different ways of being 0.00 - 0.00 (threefold) would be the same <em>value</em> as 0.00 (stalemate), but the user could still be shown which it is.</p>
  <p>But it'd always be quite random which of the many 0.00s in the entire tree you'd get to see.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-11-24T15:20:08.270Z
Answers.LastActivityDate: 2021-11-24T15:20:08.270Z
Answers.UserDisplayName: RemcoGerlich
Body: <p>I get that from the point of view of the engine there's no difference; equal is equal. But for a human analyzing with an engine, I find quite important to note that a move takes to a balanced position or to a threefold repetition (which finishes the game).</p>
  <p>For example, say I'm analyzing a position from my favorite opening, and the engine says the best move is d4(+0.10), and the second one is h6(0.00). But it happens that h6 will be draw by repetition. Depending on my mood or my position on a tournament or whatever other factors, I could prefer one or another, and the fact that h6 just finishes the game is quite important in my opinion.</p>
  <p>To me the main difference is that threefold repetition just immediately finishes the game in a draw, whilst a 0.00 position can just have any final result.</p>
  <p>Of course you can check the line provided by the engine to realize that it takes to threefold repetition, but wouldn't be much useful to use some special character for it?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-11-23T12:27:44.640Z
Comments.Text: Maybe you might reformulate it a bit, the *why* is obvious: it takes work to program this :-), with a limited benefit. Maybe a chess programmer can elaborate.
Comments.UserDisplayName: Hauke Reddmann
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-12-25T18:53:58.850Z
Comments.Text: One reason is because programming languages are created to not favor any language. So while programming stockfish or other engines people put the numbers because some people might not know English.
Comments.UserDisplayName: Varun W.
Tags: <engines><analysis><threefold-repetition>
Title: Why don't engines show explicitly that a certain move takes to a threefold repetition (instead of just showing 0.00)?
ThreadText: # Why don't engines show explicitly that a certain move takes to a threefold repetition (instead of just showing 0.00)?
  
  (Asked by: username_0 on 2021-11-23)
  
  I get that from the point of view of the engine there's no difference; equal is equal. But for a human analyzing with an engine, I find quite important to note that a move takes to a balanced position or to a threefold repetition (which finishes the game).
  
  For example, say I'm analyzing a position from my favorite opening, and the engine says the best move is d4(+0.10), and the second one is h6(0.00). But it happens that h6 will be draw by repetition. Depending on my mood or my position on a tournament or whatever other factors, I could prefer one or another, and the fact that h6 just finishes the game is quite important in my opinion.
  
  To me the main difference is that threefold repetition just immediately finishes the game in a draw, whilst a 0.00 position can just have any final result.
  
  Of course you can check the line provided by the engine to realize that it takes to threefold repetition, but wouldn't be much useful to use some special character for it?
  
  **Tags:** engines, analysis, threefold-repetition
  
  > **Comments:**
  > **username_1**: Maybe you might reformulate it a bit, the *why* is obvious: it takes work to program this :-), with a limited benefit. Maybe a chess programmer can elaborate.  
  > **username_2**: One reason is because programming languages are created to not favor any language. So while programming stockfish or other engines people put the numbers because some people might not know English.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2021-11-23. Score: 8
  
  It's easy enough to make the engine say it's 0.00 because of a 3-fold repetition. If you look at [the relevant part of Stockfish's code](https://github.com/official-stockfish/Stockfish/blob/master/src/position.cpp#L1169), they are basically if statements that return a particular value if the condition is met. If you want to know if there's a 3-fold, you could add a `print "this is a 3-fold"` command and you'll have it. I'm hard-pressed to see why it matters, though. 0.00 is 0.00, regardless of whether it's insufficient material or fortress or 3-fold or whatever.
  
  It sounds like you want to know if the position is a dead draw or if it's still complex enough that you might be able to outplay your opponent. *This* is much harder to put in machine-understandable form. How would you define these things? There are certainly positions where engines have no trouble finding the best moves (and therefore all games end 1/2-1/2) while human games show it is very unbalanced.
  
  That said, there is some effort in the computer chess community to go beyond finding the simple "best move". This started with [contempt](https://www.chessprogramming.org/Contempt_Factor) for handcrafted engines, which uses the material remaining on the board as a proxy for how complex the position is. The idea is that if you set contempt high, then the engine will play inferior moves as long as it keeps more material on the board, which leaves more scope to outplay a weaker opponent. Conversely if you set negative contempt, then the engine will simplify the position and shoot for a draw. That might be what you're looking for.
  
  Today's strongest engines are all neural-network based, for which contempt is more difficult to implement. Neural network eval return W/D/L, which is the probability of a win, draw, or loss from that position; there is no number for complexity (and probably cannot be since you'd need a very large training set with labelled "complexity" to get started). People are trying the so-called *draw score*, which turns draws from worth 0.5 points to, say, worth 0.4 points. This, it is hoped, makes the engine avoid draws - after all if one move leads to a three-fold while another leads to a 10% chance of win, 80% chance of draw, and 10% chance of loss then the second move has a higher expected score and becomes preferable. But even this does not work perfectly, since your engine might assess a position as drawn while the opponent sees a big advantage, see e.g. [this game](https://tcec-chess.com/#div=sf&game=68&season=21) where Leela saw 99.3% chance of draw on move 158, and still lost the game eventually.
  
  Ultimately you still need a way to measure if a position is "dead", and a good way to do that doesn't exist (see [this question](https://chess.stackexchange.com/questions/22555/is-the-dead-position-problem-solvable)). If you have a smart idea to measure how "live" the position is, you can probably get it published in a journal.
  
  > **Comments:**
  > **username_0**: Ok, so technically is a trivial task, and wouldn't harm the engine performance. I edited my question in order to try to make it clearer why I think it'd be a desirable feature.  
  
  ---
  
  ### Answer by username_4 on 2021-11-24. Score: 4
  
  There is in general no such thing as a simple "this leads to threefold repetition". There may have been millions of different positions considered, and of those, if you select at each branch at your move the highest evaluation for you, and vice versa at the opponent's branch, that leads to a 0.00 evaluation that happened to come from a threefold.
  
  That doesn't mean that that threefold was *forced* in any way. Maybe there were a thousand different things you could have done instead but they were -0.1, or the opponent could have done but they were +0.1. And then were another thousand that *also* led to 0.00 but for different reasons: tablebase draw, stalemate...
  
  So, I guess engines could change the way they work, so that evaluation is not a fixed number but there can be different ways of being 0.00 - 0.00 (threefold) would be the same *value* as 0.00 (stalemate), but the user could still be shown which it is.
  
  But it'd always be quite random which of the many 0.00s in the entire tree you'd get to see.
  
  
  ---
  
  