0

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. However, looking at another question, 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.
1

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)
  • 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 – OganM Apr 1 '19 at 20:19
  • 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. – Fabian Fichter Apr 2 '19 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.