Robert Pope wrote: ↑Fri Apr 24, 2020 10:09 pm
So, I've always struggled to get a null move search that gives me positive results. I decided to look at the rules that Stockfish uses and see the following:
Code: Select all
// Step 9. Null move search with verification search (~40 Elo)
1 if ( !PvNode
2 && (ss-1)->currentMove != MOVE_NULL
3 && (ss-1)->statScore < 23397
4 && eval >= beta
5 && eval >= ss->staticEval
6 && ss->staticEval >= beta - 32 * depth - 30 * improving + 120 * ttPv + 292
7 && !excludedMove
8 && pos.non_pawn_material(us)
9 && (ss->ply >= thisThread->nmpMinPly || us != thisThread->nmpColor))
Can anyone help explain the conditions in lines 3-6? I can almost read them, but in particular, I'm confused about the difference between statScore, eval, and staticEval. Those sound like almost the same thing, but must obviously be different.
Sure. this line:
&& (ss-1)->statScore < 23397
means if the history scores for the move that the opponent just made was very good, do not bother trying nullmove since we are likely to fail low here. This saves time on searches that are unlikel to pass.
this line:
&& eval >= beta
eval is the hash-adjusted eval. This means it took the static eval of the current positions, and if there was a hash entry with better informaion, it gets adjusted. So sometimes eval will just be the static eval, and other times higher or lower than that. This helps in two ways, if the hash adjusted eval is higher than beta, we should probably try a nullmove even if the static eval is under beta, and if the hash adjusted eval is lower than the static eval, then it is unlikely to fail high. The verification search would see it looses if it has to search. I suggested uses of a hash modified eval a very log time ago on rec.games.chess or maybe talkchess. I used it in NOW.
this line:
&& ss->staticEval >= beta - 32 * depth - 30 * improving + 120 * ttPv + 292
gradually allows worse and worse static evals to still have a nullmove run on them. Larry actually came up with this idea in an earlier Komodo. I remember because I was dealing with ailing parents and he actually modified and compiled the code while I was away. The 30 * improving just owers this depth based margin if the position's eval has aimproved from 2 or 4 plies ago. the 120*ttPv raises the margin if the hash move came from a PV node.
Mark