# How does Stockfish calculate advantage? [duplicate]

Recently when I was on Lichess, somebody pointed out in chat that Stockfish calculated advantage based on what it considered as the best move for both sides. However, when we play the best moves (moves suggested by Stockfish), the advantage changes, which means that the advantage cannot be solely calculated assuming best moves.

However, the advantage cannot be calculated based on some kind of weighted mean of the possible moves either since Stockfish clearly spots winning strategies such as 'Mate in n' for sufficiently small n.

To make the previous paragraph clear, assume that white has mate in 1, and assume that white has 2 legal moves. Also assume that if white doesn't play the move of checkmate, then black has a forced move that is also mate. In this scenario, if we were taking average, advantage would be zero since random moves would give 50% win chance for white and 50% for black. However, Stockfish would show #1.

So how does Stockfish calculate advantage?

EDIT : This question is not asking how the engine finds the best moves. I am familiar with the decision tree method that engines implement to do so. The question is about the 'advantage' value that the engine evaluates. @SubhanKhan 's comment clarifies why the advantage value changes after performing the best move. Does the engine evaluate advantage solely based on the best moves then?

• @Haran the reason that the evaluation changes when you play the best moves suggested is because when you do this it gets to look deeper and thus reconsiders. This is like if you spend 10 minutes calculating in a position and realize that you will be slightly better, but when you look for 30 minutes you look deeper and realize it will be equal. I hope it helps! Feb 20, 2020 at 8:40
• @SubhanKhan Yes, the comment was very helpful. +1 from my side. You are welcome to post the above as an answer too. Does this mean that engines do calculate evaluation based on what it sees as the best move? Feb 20, 2020 at 9:00