4

I was setup stockfish with:

uci
setoption name hash value 128
setoption name threads value 4

That I try to evaluate my first moves to learn how it works (I am programmer) but I received random results.

go depth 20

First result cp = 16

info depth 20 seldepth 30 multipv 1 score cp 16 nodes 1327846 nps 1074309 hashfull 585 tbhits 0 time 1236 pv e2e4 e7e6 d2d4 d7d5 e4d5 e6d5 f1d3 g8f6 g1f3 f8d6 e1g1 e8g8 b1c3 c7c6 f3e5 f8e8 c1f4 f6g4 f1e1 d6e5 f4e5 g4e5 e1e5
bestmove e2e4 ponder e7e6

Second result cp = 20.

info depth 20 seldepth 29 multipv 1 score cp 20 nodes 4912037 nps 1040685 hashfull 986 tbhits 0 time 4720 pv e2e4 e7e6 d2d4 d7d5 e4d5 e6d5 f1d3 g8f6 g1f3 f8d6 e1g1 e8g8 b1c3 b8c6 c1g5 c6b4 c3b5 h7h6 b5d6 d8d6
bestmove e2e4 ponder e7e6

Why each time Stockfish produce something else for 20 depth - different scores - same move e2e4?

1 Answer 1

4

The reason is simple - hashing. The first time you run the analysis, the engine stored the computed positions in a hash-table. This table was not clear the next time you run the analysis. Next time, when you ran the same analysis, the engine could search further and thus returned a different score for it's principal variation.

Evidence? Note the node counts was: 1327846 for your first attempt and 4912037 for your second attempt. The NPS (nodes per second) was very close (1074309 vs 1040685). Clearly Stockfish used the existing hash-table to skip moves it had already computed in your first attempt.

Note that this is an expected behaviors, clearing hash-table after each move would dramatically reduce the engine strength.

3
  • 1
    I still not understand it clearly. When I specify 20 depth it should give same results but it looks that hashtable has some impact every iteration. I assume that 20 depth need always same nps and not understand it need more nps next time?
    – Chameleon
    Commented Mar 29, 2016 at 11:46
  • @Chameleon Chess engine isn't that simple. The engine would search over depth 20 like q-search if necessary.
    – SmallChess
    Commented Mar 29, 2016 at 11:53
  • @Chameleon: (old post I know) The engine does not do a complete traversal, but skips nodes; compare seldepth with depth; seldepth often is a maximum search depth, depth itself more like a typical depth for selected nodes
    – Sebastian
    Commented Nov 19, 2020 at 21:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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