mirror of
https://github.com/sockspls/badfish
synced 2025-05-02 01:29:36 +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:
parent
2161d8b0b3
commit
a66f31f129
1 changed files with 16 additions and 16 deletions
|
@ -1814,6 +1814,7 @@ namespace {
|
||||||
bool useFutilityPruning = sp->depth < SelectiveDepth
|
bool useFutilityPruning = sp->depth < SelectiveDepth
|
||||||
&& !isCheck;
|
&& !isCheck;
|
||||||
|
|
||||||
|
const int FutilityMoveCountMargin = 3 + (1 << (3 * int(sp->depth) / 8));
|
||||||
const int FutilityValueMargin = 112 * bitScanReverse32(int(sp->depth) * int(sp->depth) / 2);
|
const int FutilityValueMargin = 112 * bitScanReverse32(int(sp->depth) * int(sp->depth) / 2);
|
||||||
|
|
||||||
while ( sp->bestValue < sp->beta
|
while ( sp->bestValue < sp->beta
|
||||||
|
@ -1842,31 +1843,30 @@ namespace {
|
||||||
&& !captureOrPromotion)
|
&& !captureOrPromotion)
|
||||||
{
|
{
|
||||||
// Move count based pruning
|
// Move count based pruning
|
||||||
if ( moveCount >= 2 + int(sp->depth)
|
if ( moveCount >= FutilityMoveCountMargin
|
||||||
&& ok_to_prune(pos, move, ss[sp->ply].threatMove)
|
&& ok_to_prune(pos, move, ss[sp->ply].threatMove)
|
||||||
&& sp->bestValue > value_mated_in(PLY_MAX))
|
&& sp->bestValue > value_mated_in(PLY_MAX))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Value based pruning
|
// 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 (futilityValueScaled > sp->bestValue)
|
||||||
lock_grab(&(sp->lock));
|
sp->bestValue = futilityValueScaled;
|
||||||
if (sp->futilityValue > sp->bestValue)
|
lock_release(&(sp->lock));
|
||||||
sp->bestValue = sp->futilityValue;
|
|
||||||
lock_release(&(sp->lock));
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue