Answers.Body: <p>If the root position you set up on the board is covered by the syzygy tablebases you loaded, you can just directly query the tablebases using the Stockfish-specific (non-UCI) command <code>d</code>, see the example below.</p>
  
  <p>Since syzygy tablebases are depth-to-zero (DTZ) and not depth-to-mate (DTM) (see <a href="https://www.chessprogramming.org/Endgame_Tablebases#Metrics" rel="nofollow noreferrer">https://www.chessprogramming.org/Endgame_Tablebases#Metrics</a> for the definitions), what you get is the result with perfect play for the side to move as well as the number of half moves until the 50 move rule counter will be reset due to a capture or pawn move.</p>
  
  <p>input:</p>
  
  <pre><code>setoption name SyzygyPath value {path to your tablebases}
  position fen 8/8/8/5k2/8/1R6/R7/4K3 w - - 0 1
  d
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>info string Found 35 tablebases
  
   +---+---+---+---+---+---+---+---+
   |   |   |   |   |   |   |   |   |
   +---+---+---+---+---+---+---+---+
   |   |   |   |   |   |   |   |   |
   +---+---+---+---+---+---+---+---+
   |   |   |   |   |   |   |   |   |
   +---+---+---+---+---+---+---+---+
   |   |   |   |   |   | k |   |   |
   +---+---+---+---+---+---+---+---+
   |   |   |   |   |   |   |   |   |
   +---+---+---+---+---+---+---+---+
   |   | R |   |   |   |   |   |   |
   +---+---+---+---+---+---+---+---+
   | R |   |   |   |   |   |   |   |
   +---+---+---+---+---+---+---+---+
   |   |   |   |   | K |   |   |   |
   +---+---+---+---+---+---+---+---+
  
  Fen: 8/8/8/5k2/8/1R6/R7/4K3 w - - 0 1
  Key: 48F90DF481A6F1D6
  Checkers: 
  Tablebases WDL:  Win (Success)
  Tablebases DTZ:    7 (Success)
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-25T10:33:45.180Z
Answers.LastActivityDate: 2019-05-25T10:33:45.180Z
Answers.UserDisplayName: Fabian Fichter
Body: <p>Playing around with the Stockfish 8 UCI from the terminal, I've managed to make it compute moves, and set the position and load Syzygy tables.</p>
  
  <p>But how I can know if an endgame, one that corresponds to the kind of endgame I've loaded, is winnable or drawable?</p>
  
  <p>I've looked at the Stockfish UCI protocol, but I have not found the relevant information.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-18T00:08:10.480Z
Comments.Text: The score would tell you that.
Comments.UserDisplayName: SmallChess
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-18T00:14:02.403Z
Comments.Text: Thank you. It seems that I must investigate more about how to interpret the score. Also do I really need to provide SYZYGY tables or can StockFish give good scores without them ?
Comments.UserDisplayName: loloof64
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-18T06:27:36.010Z
Comments.Text: If I'm right, Stockfish shows +123.53 for win in 7+ pieces position that uses tablebase win and +250.00 for 6- pieces win. Not sure how it scores blessed wins. If I'm wrong just write me and I will delete the comment, I know Komodo values but saw also those of Stockfish some time ago.
Comments.UserDisplayName: hoacin
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-18T09:25:52.563Z
Comments.Text: Thank you. I'll try to check that for 6- pieces win (that's my main use case) and also investigate more into Stockfish official resources.
Comments.UserDisplayName: loloof64
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-18T09:37:58.343Z
Comments.Text: I've checked with Stockfish in command line. With the position "8/8/8/5k2/8/1R6/R7/4K3 w - - 0 1" (mat with two rooks) I got "info depth 7 seldepth 10 multipv 1 score cp 5133 nodes 10566 nps 1056600 tbhits 0 time 10 pv a2a6 f5e5 b3b5 e5d4 a6a4 d4c3 a4f4 c3d3 b5b3 d3c2
  " which, is score +51.33 (cp 5133). So I guess a score of absolute value of 50.00 should be enough.
Comments.UserDisplayName: loloof64
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-18T09:41:14.647Z
Comments.Text: But when trying with "position fen 8/8/8/5k2/8/1R6/R7/4K3 b - - 0 1" I directly got a mate (in 8 moves) : "info depth 11 seldepth 15 multipv 1 score mate -8 upperbound nodes 24370 nps 1523125 tbhits 0 time 16 pv f5e6 a2a6". Strange that the same position with white turn did not give me mate score.
Comments.UserDisplayName: loloof64
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-18T09:44:03.907Z
Comments.Text: In fact, trying again with white turn gave me mate "info depth 12 seldepth 12 multipv 1 score mate 6 nodes 7312 nps 812444 tbhits 0 time 9 pv b3b5 f5e6 a2a6 e6d7 b5b7 d7c8 b7f7 c8b8 a6a4 b8c8 a4a8". I don't know why the first time it did not gave that (same position than my first try).
Comments.UserDisplayName: loloof64
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-18T11:59:31.537Z
Comments.Text: Finally "setoption name Minimum Thinking Time value 800" solved the issue.
Comments.UserDisplayName: loloof64
Tags: <endgame><stockfish><tablebases><uci>
Title: How to use ending evaluation in UCI interaction with Stockfish
ThreadText: # How to use ending evaluation in UCI interaction with Stockfish
  
  (Asked by: username_0 on 2017-05-18)
  
  Playing around with the Stockfish 8 UCI from the terminal, I've managed to make it compute moves, and set the position and load Syzygy tables.
  
  But how I can know if an endgame, one that corresponds to the kind of endgame I've loaded, is winnable or drawable?
  
  I've looked at the Stockfish UCI protocol, but I have not found the relevant information.
  
  **Tags:** endgame, stockfish, tablebases, uci
  
  > **Comments:**
  > **username_1**: The score would tell you that.  
  > **username_0**: Thank you. It seems that I must investigate more about how to interpret the score. Also do I really need to provide SYZYGY tables or can StockFish give good scores without them ?  
  > **username_2**: If I'm right, Stockfish shows +123.53 for win in 7+ pieces position that uses tablebase win and +250.00 for 6- pieces win. Not sure how it scores blessed wins. If I'm wrong just write me and I will delete the comment, I know Komodo values but saw also those of Stockfish some time ago.  
  > **username_0**: Thank you. I'll try to check that for 6- pieces win (that's my main use case) and also investigate more into Stockfish official resources.  
  > **username_0**: I've checked with Stockfish in command line. With the position "8/8/8/5k2/8/1R6/R7/4K3 w - - 0 1" (mat with two rooks) I got "info depth 7 seldepth 10 multipv 1 score cp 5133 nodes 10566 nps 1056600 tbhits 0 time 10 pv a2a6 f5e5 b3b5 e5d4 a6a4 d4c3 a4f4 c3d3 b5b3 d3c2 " which, is score +51.33 (cp 5133). So I guess a score of absolute value of 50.00 should be enough.  
  > **username_0**: But when trying with "position fen 8/8/8/5k2/8/1R6/R7/4K3 b - - 0 1" I directly got a mate (in 8 moves) : "info depth 11 seldepth 15 multipv 1 score mate -8 upperbound nodes 24370 nps 1523125 tbhits 0 time 16 pv f5e6 a2a6". Strange that the same position with white turn did not give me mate score.  
  > **username_0**: In fact, trying again with white turn gave me mate "info depth 12 seldepth 12 multipv 1 score mate 6 nodes 7312 nps 812444 tbhits 0 time 9 pv b3b5 f5e6 a2a6 e6d7 b5b7 d7c8 b7f7 c8b8 a6a4 b8c8 a4a8". I don't know why the first time it did not gave that (same position than my first try).  
  > **username_0**: Finally "setoption name Minimum Thinking Time value 800" solved the issue.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2019-05-25. Score: 1 | Accepted answer
  
  If the root position you set up on the board is covered by the syzygy tablebases you loaded, you can just directly query the tablebases using the Stockfish-specific (non-UCI) command d, see the example below.
  Since syzygy tablebases are depth-to-zero (DTZ) and not depth-to-mate (DTM) (see https://www.chessprogramming.org/Endgame_Tablebases#Metrics for the definitions), what you get is the result with perfect play for the side to move as well as the number of half moves until the 50 move rule counter will be reset due to a capture or pawn move.
  input:
  setoption name SyzygyPath value {path to your tablebases}
  position fen 8/8/8/5k2/8/1R6/R7/4K3 w - - 0 1
  d
  
  output:
  info string Found 35 tablebases
  
   +---+---+---+---+---+---+---+---+
   |   |   |   |   |   |   |   |   |
   +---+---+---+---+---+---+---+---+
   |   |   |   |   |   |   |   |   |
   +---+---+---+---+---+---+---+---+
   |   |   |   |   |   |   |   |   |
   +---+---+---+---+---+---+---+---+
   |   |   |   |   |   | k |   |   |
   +---+---+---+---+---+---+---+---+
   |   |   |   |   |   |   |   |   |
   +---+---+---+---+---+---+---+---+
   |   | R |   |   |   |   |   |   |
   +---+---+---+---+---+---+---+---+
   | R |   |   |   |   |   |   |   |
   +---+---+---+---+---+---+---+---+
   |   |   |   |   | K |   |   |   |
   +---+---+---+---+---+---+---+---+
  
  Fen: 8/8/8/5k2/8/1R6/R7/4K3 w - - 0 1
  Key: 48F90DF481A6F1D6
  Checkers: 
  Tablebases WDL:  Win (Success)
  Tablebases DTZ:    7 (Success)
  
  
  ---
  
  