lichess.org
Donate

Analysis issue

Not sure how this happened, but I was checking out this position:

7k/2p2Qp1/p2p1b1p/1p3P2/6P1/4B3/P1P2P1P/1R3RK1 w - - 1 26

My opponent timed out (purposely I might add) and I was looking at what I would've done to mate him. That position was one variation I was looking at if he had played Kh8 in the final position of our game. Anyway it's mate in five with 1. Bxh6 gxh6 2. Qxf6+ Kg8 3. Rfe1 a4 4. Re8+ Kh7 5. Qg6#. There are other lines, but they're all forced mate in five or fewer.

At depth 23, Stockfish says mate in seven, which is incredibly surprising since the superior mate in five only requires 5 plies and it's analysing 23 plies deep. I only noticed it because if you analyse the position after Bxh6, it says best move for black is mate in four. I want to say it's horizon effect, but when the number of plies required is a quarter of the depth being calculated, that doesn't seem right. Seems like a bug to me.
Indeed it is the horizon effect. 90% of the strength of chess engines is knowing which moves are not worth wasting calculation time on. Sacrificing a bishop while winning by this much was so absurd to stockfish that he didn't bother to search it for 5 plies. When I made that move I could see for a fraction of a second that it says "Depth: 6" which only translates to 3 plies. When I feed it to Lc0 running locally though she found mate in 5 fine.
It's not sacrificing a bishop, though since if gxh6 Qxh6+. So you regain the piece immediately. That much is clear, even with two plies. My reasoning for why the engine should have considered this a strong move is precisely because it isn't a true sacrifice. It's really just a free pawn an obvious improvement to the position as it opens up the king.

Of course black doesn't have to play gxh6, but if he doesn't, then you're still not sacrificing anything. After the engine sees that the move isn't losing a bishop regardless of what black does, why does it discard the move? What's funny is that it finds the move at depth 24, just not at depth 23. I'm not any kind of expert in chess engines. I have a basic understanding of how they assess moves, but no great detail. So maybe I just don't understand what's happening.
Not sure why exactly this is happening but you certainly shouldn't take the depth literally. It's obviously not analyzing every move until whatever depth it says so there's basically no guarantee it will find a multi-move mate on any depth. Although I guess it might have some mechanism forcing it to start checking all moves at a low-depth at some point but not sure about that.

There has been some discussion a while ago about switching to a node limit instead to avoid this confusion but not sure yet if it will actually happen.
To analyse one ply takes a fraction of a second. I have precisely 43 legal moves, three of which are forcing and one has only two legal responses. If it were my opponents turn, he has 18 legal moves. On average, he will still have those 18 legal moves with the 39 non-forcing moves moves I can make, occasionally gaining one or losing one. Therefore the number of possible positions (nodes) is (39×~18)+5=~707.

Evaluating 707 nodes is trivial. Stockfish on my phone is analysing 4.5 million nodes per second. It shouldn't even start pruning branches until it finishes two plies as that's the point at which things start getting out of hand. For this pseudo-bishop-sac, two plies is enough to see that you're (at least) regaining the piece. So you wouldn't have thought that it would have pruned this particular branch. Have I misunderstood what's going on under the hood?

This topic has been archived and can no longer be replied to.