Answers.Body: <blockquote>
  <p>Why doesn't Stockfish announce when it solved a position as a book draw similar to how it announces a forced mate?</p>
  </blockquote>
  <p>Very simple. Checkmate ends the game. Once checkmate has been delivered there are no more moves in the game. That is a defined endpoint.</p>
  <p>A book draw does not end the game. For instance there are several RKP vs RK which are book draws. If the player without the pawn knows how to draw the game, i.e. stop the opponent from queening the pawn, then they can stop their opponent from winning and the game will eventually be a draw.</p>
  <p>There are various ways this can happen. The player with the pawn can realize that they are wasting their time and agree a draw. The position might repeat 3 times allowing the other player to claim a draw or there might be 50 moves without any captures or pawn moves when, again, the other player can claim a draw. However there is no clear point where the game ends. When exactly it ends depends of the choices of the players.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-11T18:49:06.890Z
Answers.Text: And even if someone would find such a feature useful (I do), someone would have to implement it first. Which is work :-) (It probably sits on a kilometers long nice-to-have list...)
Answers.UserDisplayName: Hauke Reddmann
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-12T15:28:16.017Z
Answers.Text: I don't understand this answer, can't the same argument be used for a checkmate? Even if there's a forced checkmate with perfect play in X moves, the choices of the players might reduce or increase the number of moves (or even entirely miss the win).
Answers.UserDisplayName: Subscribe for more Minecraft
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-12T16:30:51.390Z
Answers.Text: @CarlaParla, the thing is though, you can't increase the number of moves. Assuming perfect play, X moves is the upper limit of the number of moves left. The game will be, at most, X moves from the end. There is a strong upper limit.
Answers.UserDisplayName: user70889
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-12T17:30:49.783Z
Answers.Text: @user70889 Assuming perfect play there is still an upper limit on the number of moves left for a draw because of the threefold repetition rule. Perhaps the issue really is that the upper bound for a draw can be much larger?
Answers.UserDisplayName: Subscribe for more Minecraft
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-12T19:15:57.520Z
Answers.Text: Correct, chess is completely deterministic game. A mate is conclusive and forcing. These 6 moves force black to win for example. A draw is such a larger search space, and not always conclusive or forcing, so much harder to search. But an omniscent god/super computer, could look at the game and say ah yes, forced draw for white in 35 and forced draw for black in 28. BUt that is far beyond our computing atm.
Answers.UserDisplayName: user70889
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-11T17:42:37.253Z
Answers.LastActivityDate: 2022-12-11T17:42:37.253Z
Answers.UserDisplayName: Brian Towers
Answers.Body: <p>Chess engines have evaluations <strong>so that they can choose the best move</strong>. It assumes that whenever white has the move, it picks the move with the highest number, and black will choose the one with the lowest (at any point in the tree).</p>
  <p>And the numerical value of a draw is the same as that of an equal position - 0.00. Because any better position is better than a draw, and a worse position is worse than a draw.</p>
  <p>Now you <em>could</em> have two different &quot;0&quot; values. Perhaps (it'd make the engine a tiny bit slower, and thus weaker, but OK).</p>
  <p>But the evaluation of the position is the result of comparing <em>tens of thousands</em> of such numbers -- the value of the current position, if white is to move, is the maximum of the values for each of the moves white can do; which is the minimum of the values of all the replies black has; which is the maximum of the values of all the second moves white could reply to <em>those</em>, et cetera.</p>
  <p>Stockfish builds a whole tree of variations, at the end of each branch is a number. Many of them will be equal, and also many of them will be draws.</p>
  <p>So what is the value if there are two moves, one evaluating to an equal position and one to a drawn position? There's no reasonable way to choose.</p>
  <p>And as they're both 0.00 so it doesn't actually matter, and make the engine a bit slower, nobody does this.</p>
  <p>This problem doesn't happen with checkmate -- no matter how good the evaluation, forced checkmate is better. And checkmate in 8 moves is better than in 9 moves.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-12T19:12:23.667Z
Answers.LastActivityDate: 2022-12-12T19:12:23.667Z
Answers.UserDisplayName: RemcoGerlich
Answers.Body: <p>Stockfish doesn't know what a book draw is, and it would be difficult to code because of endless variations.</p>
  <p>For example, this position is a book draw:</p>
  <pre><code>[fen &quot;3k4/1r2p3/r2pPp2/b1pP1Pp1/1pP3Pp/pP5P/P2K4/8 w - - 0 6&quot;]
  </code></pre>
  <p>But it is also a book draw if the rook is on a7, a8, b8, c8, etc. How would you code it so that all of them are recognized as book draws? You can't realistically hard code all such positions.</p>
  <p>Another issue with book draws is that they assume perfect play from the opponent. Sometimes the defense is difficult or even impossible for humans. The <a href="https://en.wikipedia.org/wiki/Rook_and_bishop_versus_rook_endgame" rel="nofollow noreferrer">KR vs. KRB endgame</a> is one such example. Here is another one from the most recent World Chess Championship.</p>
  <pre><code>[fen &quot;4k3/8/8/4PR2/5P2/6NK/q7/8 w - - 0 1&quot;]
  </code></pre>
  <p>This position with Black to play is also a book draw, as one can see from endgame tablebases, but it's complex enough that no human would be able to hold the Black position, and even Stockfish doesn't provide 0.00 eval when denied tablebases.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-12T04:14:02.197Z
Answers.Text: The question specifies "when Stockfish can solve a position as being a draw with best play from both players" so I don't think the first position is too relevant. If Stockfish can't solve it then it can't solve it. OP is asking about the cases when it *can* solve it.
Answers.UserDisplayName: D M
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-12T15:23:49.190Z
Answers.Text: What the heck kind of answer is this? 1. Hard coding is not the only kind of coding. When it's not appropriate, use soft coding. 2. Obviously we have not solved chess, and so there are probably draws we don't know about. That shouldn't stop us from marking the draws we *do* know about. 3. If you remove part of my brain, I probably start evaluating positions differently, too. That doesn't mean the position's value is actually different. 4. Computers are inhuman. News at 11. That's the reason we *have* them, why would we intentionally bring them down to our level when using them as tools?
Answers.UserDisplayName: Daniel Wagner
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-12T03:11:09.200Z
Answers.LastActivityDate: 2022-12-12T03:11:09.200Z
Answers.UserDisplayName: Allure
Answers.Body: <p>Most forced outcomes are only forced in scenarios where both sides can be presumed to play optimally.  In cases where Stockfish identifies and announces a forced mate in N for White, its announcement means that if Stockfish were given and allowed to keep control of White's pieces, then both sides would be guaranteed to play optimally so as to yield a score of 1-0:</p>
  <ol>
  <li><p>If Black resigns, the score would be 1-0 (no worse for Black than any other course of action).</p>
  </li>
  <li><p>If Black runs out of time, the score would be 1-0 (again, no worse than any other course of action).</p>
  </li>
  <li><p>If Black makes a move, either White will be able to checkamte, or make a move that forces a mate in at most N-1 moves (again, no worse...)</p>
  </li>
  <li><p>If there's a power failure, that would violate the requirement that Stockfish be allowed to keep control of the White pieces, rendering that scenario irrelevant.</p>
  </li>
  </ol>
  <p>Unless there is a forced win by a side that's guaranteed to play optimally, however, the outcome of a match wouldn't really be forced.  Even in the scenario where White has a king on a1, Black has a king on h8, and White has just moved Qg7+?? with no other pieces on the board, it would still be possible for either side to play sub-optimally by resigning at any point prior to Black either making the only legal move or running out of time [the latter resulting in a draw because no legal sequence of moves could result in checkmate].</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-12T23:54:37.893Z
Answers.Text: I guess the "White runs out of time" scenario doesn't apply when it's already solved?
Answers.UserDisplayName: Paŭlo Ebermann
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-13T16:03:54.713Z
Answers.Text: In a game between Stockfish and some outside entity, Stockfish has no way of knowing whether the opponent will make an optimal move, make a sub-optimal move,, run out of time, or resign, except that in the scenario where Stockfish has a forced win there would be no sub-optimal moves the opponent could make.  What's significant is that the result will be 1-0 for Stockfish unless it is prevented from controlling its pieces.
Answers.UserDisplayName: supercat
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-16T19:00:30.577Z
Answers.Text: I meant the scenario where Stockfish runs out of time. Then it would lose despite having a forced win.
Answers.UserDisplayName: Paŭlo Ebermann
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-16T20:22:32.370Z
Answers.Text: @PaŭloEbermann: If Stockfish has the position in a tablebase, and is allowed to move its pieces without delay, it shouldn't run out of time.  If something prevents Stockfish from moving its pieces instantly once it has located a position in the tablebase, that would fall under category #4 above.
Answers.UserDisplayName: supercat
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-12T19:23:28.490Z
Answers.LastActivityDate: 2022-12-12T19:23:28.490Z
Answers.UserDisplayName: supercat
Body: <p>I notice that when Stockfish has solved a position to mate it announces that checkmate is unavoidable in some number of moves so it's impossible to mistaken a position Stockfish has solved as a win for one player for a position that Stockfish has merely evaluated as being a position, for which one player has a huge advantage but not solved to the end yet.</p>
  <p>On the other hand if Stockfish solves a position as being a draw with best play it just shows the position as being evaluated as 0.0 instead of announcing that it's a draw with best play, however an evaluation of 0.0 can also just indicate that Stockfish can't find an advantage for either player and doesn't necessarily mean it solved it to the end and found it to be a draw with best play from both players.</p>
  <p>So my question is when Stockfish can solve a position as being a draw with best play from both players why doesn't the evaluation start saying &quot;Draw&quot; instead of &quot;0.0&quot; to show that the engine has solved it?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-12-11T16:06:57.257Z
Comments.Text: [very related](https://chess.stackexchange.com/questions/710/is-there-any-chess-engine-that-can-show-if-one-side-has-a-forced-draw) but I don't think it is a duplicate
Comments.UserDisplayName: Minot
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-12-13T15:38:03.130Z
Comments.Text: "Keep playing until the end of the game". That's the rule, which speaks for itself.
Comments.UserDisplayName: Billy Istiak
Tags: <stockfish><draw><evaluation>
Title: Why doesn't Stockfish announce when it solved a position as a book draw similar to how it announces a forced mate?
ThreadText: # Why doesn't Stockfish announce when it solved a position as a book draw similar to how it announces a forced mate?
  
  (Asked by: username_0 on 2022-12-11)
  
  I notice that when Stockfish has solved a position to mate it announces that checkmate is unavoidable in some number of moves so it's impossible to mistaken a position Stockfish has solved as a win for one player for a position that Stockfish has merely evaluated as being a position, for which one player has a huge advantage but not solved to the end yet.
  
  On the other hand if Stockfish solves a position as being a draw with best play it just shows the position as being evaluated as 0.0 instead of announcing that it's a draw with best play, however an evaluation of 0.0 can also just indicate that Stockfish can't find an advantage for either player and doesn't necessarily mean it solved it to the end and found it to be a draw with best play from both players.
  
  So my question is when Stockfish can solve a position as being a draw with best play from both players why doesn't the evaluation start saying "Draw" instead of "0.0" to show that the engine has solved it?
  
  **Tags:** stockfish, draw, evaluation
  
  > **Comments:**
  > **username_1**: [very related](https://chess.stackexchange.com/questions/710/is-there-any-chess-engine-that-can-show-if-one-side-has-a-forced-draw) but I don't think it is a duplicate  
  > **username_2**: "Keep playing until the end of the game". That's the rule, which speaks for itself.  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_3 on 2022-12-11. Score: 4
  
  > Why doesn't Stockfish announce when it solved a position as a book draw similar to how it announces a forced mate?
  
  Very simple. Checkmate ends the game. Once checkmate has been delivered there are no more moves in the game. That is a defined endpoint.
  
  A book draw does not end the game. For instance there are several RKP vs RK which are book draws. If the player without the pawn knows how to draw the game, i.e. stop the opponent from queening the pawn, then they can stop their opponent from winning and the game will eventually be a draw.
  
  There are various ways this can happen. The player with the pawn can realize that they are wasting their time and agree a draw. The position might repeat 3 times allowing the other player to claim a draw or there might be 50 moves without any captures or pawn moves when, again, the other player can claim a draw. However there is no clear point where the game ends. When exactly it ends depends of the choices of the players.
  
  > **Comments:**
  > **username_4**: And even if someone would find such a feature useful (I do), someone would have to implement it first. Which is work :-) (It probably sits on a kilometers long nice-to-have list...)  
  > **username_5**: I don't understand this answer, can't the same argument be used for a checkmate? Even if there's a forced checkmate with perfect play in X moves, the choices of the players might reduce or increase the number of moves (or even entirely miss the win).  
  > **username_6**: @CarlaParla, the thing is though, you can't increase the number of moves. Assuming perfect play, X moves is the upper limit of the number of moves left. The game will be, at most, X moves from the end. There is a strong upper limit.  
  > **username_5**: @username_6 Assuming perfect play there is still an upper limit on the number of moves left for a draw because of the threefold repetition rule. Perhaps the issue really is that the upper bound for a draw can be much larger?  
  > **username_6**: Correct, chess is completely deterministic game. A mate is conclusive and forcing. These 6 moves force black to win for example. A draw is such a larger search space, and not always conclusive or forcing, so much harder to search. But an omniscent god/super computer, could look at the game and say ah yes, forced draw for white in 35 and forced draw for black in 28. BUt that is far beyond our computing atm.  
  
  ---
  
  ### Answer by username_7 on 2022-12-12. Score: 0
  
  Chess engines have evaluations **so that they can choose the best move**. It assumes that whenever white has the move, it picks the move with the highest number, and black will choose the one with the lowest (at any point in the tree).
  
  And the numerical value of a draw is the same as that of an equal position - 0.00. Because any better position is better than a draw, and a worse position is worse than a draw.
  
  Now you *could* have two different "0" values. Perhaps (it'd make the engine a tiny bit slower, and thus weaker, but OK).
  
  But the evaluation of the position is the result of comparing *tens of thousands* of such numbers -- the value of the current position, if white is to move, is the maximum of the values for each of the moves white can do; which is the minimum of the values of all the replies black has; which is the maximum of the values of all the second moves white could reply to *those*, et cetera.
  
  Stockfish builds a whole tree of variations, at the end of each branch is a number. Many of them will be equal, and also many of them will be draws.
  
  So what is the value if there are two moves, one evaluating to an equal position and one to a drawn position? There's no reasonable way to choose.
  
  And as they're both 0.00 so it doesn't actually matter, and make the engine a bit slower, nobody does this.
  
  This problem doesn't happen with checkmate -- no matter how good the evaluation, forced checkmate is better. And checkmate in 8 moves is better than in 9 moves.
  
  
  ---
  
  ### Answer by username_8 on 2022-12-12. Score: 0
  
  Stockfish doesn't know what a book draw is, and it would be difficult to code because of endless variations.
  For example, this position is a book draw:
  [fen "3k4/1r2p3/r2pPp2/b1pP1Pp1/1pP3Pp/pP5P/P2K4/8 w - - 0 6"]
  
  But it is also a book draw if the rook is on a7, a8, b8, c8, etc. How would you code it so that all of them are recognized as book draws? You can't realistically hard code all such positions.
  Another issue with book draws is that they assume perfect play from the opponent. Sometimes the defense is difficult or even impossible for humans. The KR vs. KRB endgame is one such example. Here is another one from the most recent World Chess Championship.
  [fen "4k3/8/8/4PR2/5P2/6NK/q7/8 w - - 0 1"]
  
  This position with Black to play is also a book draw, as one can see from endgame tablebases, but it's complex enough that no human would be able to hold the Black position, and even Stockfish doesn't provide 0.00 eval when denied tablebases.
  
  > **Comments:**
  > **username_9**: The question specifies "when Stockfish can solve a position as being a draw with best play from both players" so I don't think the first position is too relevant. If Stockfish can't solve it then it can't solve it. OP is asking about the cases when it *can* solve it.  
  > **username_10**: What the heck kind of answer is this? 1. Hard coding is not the only kind of coding. When it's not appropriate, use soft coding. 2. Obviously we have not solved chess, and so there are probably draws we don't know about. That shouldn't stop us from marking the draws we *do* know about. 3. If you remove part of my brain, I probably start evaluating positions differently, too. That doesn't mean the position's value is actually different. 4. Computers are inhuman. News at 11. That's the reason we *have* them, why would we intentionally bring them down to our level when using them as tools?  
  
  ---
  
  ### Answer by username_11 on 2022-12-12. Score: 0
  
  Most forced outcomes are only forced in scenarios where both sides can be presumed to play optimally. In cases where Stockfish identifies and announces a forced mate in N for White, its announcement means that if Stockfish were given and allowed to keep control of White's pieces, then both sides would be guaranteed to play optimally so as to yield a score of 1-0:
  
  1. If Black resigns, the score would be 1-0 (no worse for Black than any other course of action).
  2. If Black runs out of time, the score would be 1-0 (again, no worse than any other course of action).
  3. If Black makes a move, either White will be able to checkamte, or make a move that forces a mate in at most N-1 moves (again, no worse...)
  4. If there's a power failure, that would violate the requirement that Stockfish be allowed to keep control of the White pieces, rendering that scenario irrelevant.
  
  Unless there is a forced win by a side that's guaranteed to play optimally, however, the outcome of a match wouldn't really be forced. Even in the scenario where White has a king on a1, Black has a king on h8, and White has just moved Qg7+?? with no other pieces on the board, it would still be possible for either side to play sub-optimally by resigning at any point prior to Black either making the only legal move or running out of time [the latter resulting in a draw because no legal sequence of moves could result in checkmate].
  
  > **Comments:**
  > **username_12**: I guess the "White runs out of time" scenario doesn't apply when it's already solved?  
  > **username_11**: In a game between Stockfish and some outside entity, Stockfish has no way of knowing whether the opponent will make an optimal move, make a sub-optimal move,, run out of time, or resign, except that in the scenario where Stockfish has a forced win there would be no sub-optimal moves the opponent could make.  What's significant is that the result will be 1-0 for Stockfish unless it is prevented from controlling its pieces.  
  > **username_12**: I meant the scenario where Stockfish runs out of time. Then it would lose despite having a forced win.  
  > **username_11**: @PaŭloEbermann: If Stockfish has the position in a tablebase, and is allowed to move its pieces without delay, it shouldn't run out of time.  If something prevents Stockfish from moving its pieces instantly once it has located a position in the tablebase, that would fall under category #4 above.  
  
  ---
  
  