1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-01 01:03:09 +00:00

Synchronize pruning rules in search and sp_search

Regression test passed:

Mod - Orig: 365 - 351

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Joona Kiiski 2009-12-10 17:24:18 +02:00 committed by Marco Costalba
parent 2161d8b0b3
commit a66f31f129

View file

@ -1814,6 +1814,7 @@ namespace {
bool useFutilityPruning = sp->depth < SelectiveDepth
&& !isCheck;
const int FutilityMoveCountMargin = 3 + (1 << (3 * int(sp->depth) / 8));
const int FutilityValueMargin = 112 * bitScanReverse32(int(sp->depth) * int(sp->depth) / 2);
while ( sp->bestValue < sp->beta
@ -1842,31 +1843,30 @@ namespace {
&& !captureOrPromotion)
{
// Move count based pruning
if ( moveCount >= 2 + int(sp->depth)
if ( moveCount >= FutilityMoveCountMargin
&& ok_to_prune(pos, move, ss[sp->ply].threatMove)
&& sp->bestValue > value_mated_in(PLY_MAX))
continue;
// Value based pruning
if (sp->approximateEval < sp->beta)
if (sp->futilityValue == VALUE_NONE)
{
if (sp->futilityValue == VALUE_NONE)
{
EvalInfo ei;
sp->futilityValue = evaluate(pos, ei, threadID) + FutilityValueMargin;
}
EvalInfo ei;
sp->futilityValue = evaluate(pos, ei, threadID) + FutilityValueMargin;
}
if (sp->futilityValue < sp->beta)
Value futilityValueScaled = sp->futilityValue - moveCount * IncrementalFutilityMargin;
if (futilityValueScaled < sp->beta)
{
if (futilityValueScaled > sp->bestValue) // Less then 1% of cases
{
if (sp->futilityValue > sp->bestValue) // Less then 1% of cases
{
lock_grab(&(sp->lock));
if (sp->futilityValue > sp->bestValue)
sp->bestValue = sp->futilityValue;
lock_release(&(sp->lock));
}
continue;
lock_grab(&(sp->lock));
if (futilityValueScaled > sp->bestValue)
sp->bestValue = futilityValueScaled;
lock_release(&(sp->lock));
}
continue;
}
}