2929
3030int lmr_reductions_array[64 ][64 ]{0 };
3131
32- std::atomic_bool SEARCH_ABORT = ATOMIC_VAR_INIT(false );
32+ int lmp_margin[64 ][2 ]{0 };
33+ int quiet_lmp_margin[64 ]{0 };
3334
34- constexpr int see_pruning_margins[5 ] {
35+ constexpr int see_pruning_margins[5 ]
36+ {
3537 0 , -100 , -100 , -300 , -325
3638};
3739
@@ -168,6 +170,9 @@ namespace
168170 }
169171
170172 int eval = tthit ? entry.seval : eval_position (position);
173+ search.eval [search.stats .ply ] = eval;
174+
175+ bool improving = eval > search.eval [std::max (0 , search.stats .ply - 2 )];
171176
172177 if (!at_root && !in_check && depth < 6 && (eval - depth * 170 ) >= beta)
173178 return eval;
@@ -192,10 +197,10 @@ namespace
192197
193198 for (Move move; picker.next (move);)
194199 {
195- if (move_num > 3 + depth * depth )
200+ if (move_num > lmp_margin[ depth][improving] )
196201 picker.skip_quiets = true ;
197202
198- if (picker.stage >= MovePicker::Stage::GiveQuiet && move_num > depth * depth + 2 )
203+ if (picker.stage >= MovePicker::Stage::GiveQuiet && move_num > quiet_lmp_margin[ depth] )
199204 break ;
200205
201206 if (depth < 5 && move_is_capture (position, move) && move.score < see_pruning_margins[depth])
@@ -343,6 +348,10 @@ namespace Search
343348 {
344349 lmr_reductions_array[i][j] = log (i) * log (j);
345350 }
351+
352+ lmp_margin[i][1 ] = 3 + 2 * i * i;
353+ lmp_margin[i][0 ] = 3 + i * i / 1.5 ;
354+ quiet_lmp_margin[i] = 2 + i * i;
346355 }
347356 }
348357
0 commit comments