hgm wrote:gladius wrote:My previous experience here is that any changes like this have failed incredibly badly. But who knows, maybe this is the one
.
Note that you could make it even more selective by requiring not just that the last move attacked the from-square, but that it attacked it with a lower-valued piece. Equal or higher attackers are not that dangerous, as the piece could already be sufficiently protected.
Yes, that's a good idea.
I just discovered a fun problem with this approach. Since it only cares about the previous move, it pushes problems with hanging pieces over the horizon, and then drops them! Same example position, except now the bishop is threatened by a pawn push, then we make a pawn push to threaten a knight in return, they retreat the knight, and we make a nonsense move and hang the bishop!
So really, we need to do general threat detection for this to work well, which is just far too expensive to do at every node. SF even does it in the eval, however, we cache evals very aggressively, so we'd have to cache the threat results as well. Painful stuff.
position fen r1q1nr1k/pp1b2b1/n2p2pp/2pP1p2/2B4B/3Q1N1P/PPP1NPP1/1R3RK1 b - - 0 12
go depth 8
info depth 1 seldepth 1 multipv 1 score cp -34 nodes 32 nps 32000 tbhits 0 time 1 pv g6g5
info depth 2 seldepth 2 multipv 1 score cp -30 nodes 168 nps 84000 tbhits 0 time 2 pv a6b4 d3d2
info depth 3 seldepth 3 multipv 1 score cp 20 nodes 220 nps 55000 tbhits 0 time 4 pv a6b4 d3d2 g6g5
info depth 4 seldepth 4 multipv 1 score cp 11 nodes 320 nps 40000 tbhits 0 time 8 pv a6b4 d3d2 b7b5 c4b3
info depth 5 seldepth 5 multipv 1 score cp 22 nodes 436 nps 43600 tbhits 0 time 10 pv a6b4 d3d2 b7b5 c2c3 b5c4
info depth 6 seldepth 6 multipv 1 score cp 105 nodes 938 nps 93800 tbhits 0 time 10 pv a6b4 d3e3 b7b5 c2c3 b5c4 c3b4 c5b4
info depth 7 seldepth 7 multipv 1 score cp 197 nodes 2109 nps 191727 tbhits 0 time 11 pv a6b4 d3d2 b7b5 c2c3 b4a6 b2b3 b5c4 b3c4
info depth 8 seldepth 8 multipv 1 score cp 50 nodes 5796 nps 362250 tbhits 0 time 16 pv g6g5 h4g3 f5f4 g3h2 a6b4 d3g6 e8f6 e2f4
bestmove g6g5 ponder h4g3