Answers.Body: <p>Game theoretically the evaluation of the current position is equal to the evaluation of the position after the optimal move is played, since the evaluation of a position is defined as the result with optimal play from both sides. So although the engine technically speaking prints the score of the position after the (supposedly) best move, it at the same time gives the score for the current position, since they are identical.</p>
  
  <p>If you want to get the static evaluation of a position without any search, you can use the <code>eval</code> command in stockfish, which returns something like:</p>
  
  <pre><code>     Term    |    White    |    Black    |    Total   
               |   MG    EG  |   MG    EG  |   MG    EG 
   ------------+-------------+-------------+------------
      Material |  ----  ---- |  ----  ---- |  0.00  0.00
     Imbalance |  ----  ---- |  ----  ---- |  0.00  0.00
         Pawns |  0.34 -0.08 |  0.34 -0.08 |  0.00  0.00
       Knights |  0.00 -0.16 |  0.00 -0.16 |  0.00  0.00
       Bishops | -0.04 -0.35 | -0.04 -0.35 |  0.00  0.00
         Rooks | -0.22 -0.02 | -0.22 -0.02 |  0.00  0.00
        Queens |  0.00  0.00 |  0.00  0.00 |  0.00  0.00
      Mobility | -0.92 -1.08 | -0.92 -1.08 |  0.00  0.00
   King safety |  0.70 -0.08 |  0.70 -0.08 |  0.00  0.00
       Threats |  0.00  0.00 |  0.00  0.00 |  0.00  0.00
        Passed |  0.00  0.00 |  0.00  0.00 |  0.00  0.00
         Space |  0.60  0.00 |  0.60  0.00 |  0.00  0.00
    Initiative |  ----  ---- |  ----  ---- |  0.00  0.00
   ------------+-------------+-------------+------------
         Total |  ----  ---- |  ----  ---- |  0.00  0.00
  
  Total evaluation: 0.13 (white side)
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-01T20:19:01.890Z
Answers.Text: If the score before and after a best move is the same, how does a score change at all if we have two identical engines, each playing best moves?
  
  About `eval`, looking at the UCI documentations, this doesn't seem to be part of the UCI so I assume I shouldn't trust that it will work with other engines
Answers.UserDisplayName: OganM
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-02T14:52:33.310Z
Answers.Text: The score only changes because the engines are not perfect (which is already clear from that they usually show scores between zero/draw and mate/win, and not always exactly one of the two), so after searching further they might reevaluate the position differently. `eval` is not part of UCI, so if it works in a different engine then just by coincidence.
Answers.UserDisplayName: Fabian Fichter
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-30T12:13:33.857Z
Answers.LastActivityDate: 2019-03-30T12:13:33.857Z
Answers.UserDisplayName: Fabian Fichter
Body: <p>I am trying to interact with stockfish via UCI to get a current evaluation of the board. When you do a simple</p>
  
  <pre><code>position startpos
  go depth 10
  </code></pre>
  
  <p>The board will helpfully return</p>
  
  <pre><code>...[previous depths]
  
  info depth 10 seldepth 11 multipv 1 score cp 29 nodes 1463 nps 731500 tbhits 0 time 2 pv e2e4 e7e5 g1f3 b8c6 f1b5 a7a6 b5c6 d7c6 e1g1 c8g4 d2d3
  bestmove e2e4 ponder e7e5
  
  </code></pre>
  
  <p>From this I can see that the evaluation for the next move is cp29 and this is corroborated by a <a href="https://chess.stackexchange.com/questions/5945/how-to-get-position-evaluation-with-uci">previous question</a>. However, looking at <a href="https://chess.stackexchange.com/questions/6155/how-to-evaluate-my-move-with-uci-engine">another question</a>, it seems like the initial question is technically wrong since the evaluation is for the position that will be resulted from the next best move, rather than the score for a current position. The second question also explains a way to get the technically correct evaluation for the current position.</p>
  
  <p>My questions are</p>
  
  <ul>
  <li>What score is commonly outputted by UIs that interact with stockfish? Do other UIs also go back in history to get a score when given a position?</li>
  <li>Is it correct that the score I get is the score for the next move when I use the standard <code>go whatever</code> notation?</li>
  <li>Is there anyway to get the current score without going back in game history and force stockfish to calculate scores for all those other positions as explained in the second SE question? This forces me to fake a move backwards in time if I am using a FEN and don't know the game history for instance which doesn't seem like the right thing to do, nor it should be necessary.</li>
  </ul>
  
Tags: <stockfish><uci>
Title: Standard for current position evaluation via UCIs
ThreadText: # Standard for current position evaluation via UCIs
  
  (Asked by: username_0 on 2019-03-29)
  
  I am trying to interact with stockfish via UCI to get a current evaluation of the board. When you do a simple
  
  ```
  position startpos
  go depth 10
  
  ```
  
  The board will helpfully return
  
  ```
  ...[previous depths]
  
  info depth 10 seldepth 11 multipv 1 score cp 29 nodes 1463 nps 731500 tbhits 0 time 2 pv e2e4 e7e5 g1f3 b8c6 f1b5 a7a6 b5c6 d7c6 e1g1 c8g4 d2d3
  bestmove e2e4 ponder e7e5
  
  ```
  
  From this I can see that the evaluation for the next move is cp29 and this is corroborated by a [previous question](https://chess.stackexchange.com/questions/5945/how-to-get-position-evaluation-with-uci). However, looking at [another question](https://chess.stackexchange.com/questions/6155/how-to-evaluate-my-move-with-uci-engine), it seems like the initial question is technically wrong since the evaluation is for the position that will be resulted from the next best move, rather than the score for a current position. The second question also explains a way to get the technically correct evaluation for the current position.
  
  My questions are
  
  * What score is commonly outputted by UIs that interact with stockfish? Do other UIs also go back in history to get a score when given a position?
  * Is it correct that the score I get is the score for the next move when I use the standard `go whatever` notation?
  * Is there anyway to get the current score without going back in game history and force stockfish to calculate scores for all those other positions as explained in the second SE question? This forces me to fake a move backwards in time if I am using a FEN and don't know the game history for instance which doesn't seem like the right thing to do, nor it should be necessary.
  
  **Tags:** stockfish, uci
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-03-30. Score: 2 | Accepted answer
  
  Game theoretically the evaluation of the current position is equal to the evaluation of the position after the optimal move is played, since the evaluation of a position is defined as the result with optimal play from both sides. So although the engine technically speaking prints the score of the position after the (supposedly) best move, it at the same time gives the score for the current position, since they are identical.
  
  If you want to get the static evaluation of a position without any search, you can use the `eval` command in stockfish, which returns something like:
  
  ```
       Term    |    White    |    Black    |    Total   
               |   MG    EG  |   MG    EG  |   MG    EG 
   ------------+-------------+-------------+------------
      Material |  ----  ---- |  ----  ---- |  0.00  0.00
     Imbalance |  ----  ---- |  ----  ---- |  0.00  0.00
         Pawns |  0.34 -0.08 |  0.34 -0.08 |  0.00  0.00
       Knights |  0.00 -0.16 |  0.00 -0.16 |  0.00  0.00
       Bishops | -0.04 -0.35 | -0.04 -0.35 |  0.00  0.00
         Rooks | -0.22 -0.02 | -0.22 -0.02 |  0.00  0.00
        Queens |  0.00  0.00 |  0.00  0.00 |  0.00  0.00
      Mobility | -0.92 -1.08 | -0.92 -1.08 |  0.00  0.00
   King safety |  0.70 -0.08 |  0.70 -0.08 |  0.00  0.00
       Threats |  0.00  0.00 |  0.00  0.00 |  0.00  0.00
        Passed |  0.00  0.00 |  0.00  0.00 |  0.00  0.00
         Space |  0.60  0.00 |  0.60  0.00 |  0.00  0.00
    Initiative |  ----  ---- |  ----  ---- |  0.00  0.00
   ------------+-------------+-------------+------------
         Total |  ----  ---- |  ----  ---- |  0.00  0.00
  
  Total evaluation: 0.13 (white side)
  
  ```
  
  > **Comments:**
  > **username_0**: If the score before and after a best move is the same, how does a score change at all if we have two identical engines, each playing best moves?  About `eval`, looking at the UCI documentations, this doesn't seem to be part of the UCI so I assume I shouldn't trust that it will work with other engines  
  > **username_1**: The score only changes because the engines are not perfect (which is already clear from that they usually show scores between zero/draw and mate/win, and not always exactly one of the two), so after searching further they might reevaluate the position differently. `eval` is not part of UCI, so if it works in a different engine then just by coincidence.  
  
  ---
  
  