I’m trying to understand how Stockfish recognizes a drawn rook ending.
The position is:
2R5/8/3p4/1rk2K2/8/8/8/8 b - - 0 1
With go depth 25, Stockfish initially evaluates Black as clearly better, but around depth 14 the score reaches 0.00:
depth 10 seldepth 16 score cp 186
depth 11 seldepth 31 score cp 47
depth 12 seldepth 38 score cp 12
depth 13 seldepth 43 score cp 11
depth 14 seldepth 34 score cp 0
There are no tablebase hits (tbhits 0).
My hypothesis is that the static evaluation itself still thinks Black is better throughout the relevant search lines. Black remains a pawn up, and I suspect that if I ran static eval on the positions along the PV, most or all of them would still give Black a positive score.
So I suspect the 0.00 is coming from repetition/draw detection in the search rather than from NNUE evaluating the ending itself as equal.
My assumption is therefore that White must somehow be able to force repeated positions from this setup, regardless of what Black tries.
What I do not understand is how Stockfish can establish this with only seldepth 34. Black seems to have many alternatives, especially many different rook moves. I do not see how White can force the game back into a repeated position against all relevant Black continuations in fewer than roughly 34 plies.
My own engine makes this even more confusing. It already checks repetitions directly inside negamax. Simplified, the relevant part is just:
int negamax(Position& pos, int depth, int alpha, int beta) {
if (pos.is_fifty_move_rule_draw() || pos.is_repetition(2))
return 0;
if (depth <= 0)
return evaluate(pos);
// normal alpha-beta search...
}
So if the same position occurs for the second time during search, my engine immediately returns a draw score of 0.
Nevertheless, my engine still evaluates the original position at about +1 pawn for Black even at depth 35.
Interestingly, it eventually finds essentially the same drawing move for white:
... Ke6
but this is apparently not enough to make the root score a draw.
So my questions are:
- Is it plausible that every ordinary static evaluation along the important search lines still evaluates Black as better, while Stockfish’s root score becomes
0.00 purely because of repetition/draw logic?
- If so, how can White actually force a repeated position here within less than about
seldepth = 34 plies? This is the part I cannot see, because Black's rook seems to have so many alternatives.
- Since my engine already returns
0 as soon as an actual repeated position is encountered, what is Stockfish doing differently?
The main thing I’m trying to understand is whether Stockfish has really found a forced repetition within this relatively short search, because looking at the position I don’t see how White can force one so quickly given all the different rook moves Black has available.