mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 01:03:09 +00:00
Retire futility_move_count()
And remove (bestValue < beta) condition from moves loop. No functional change.
This commit is contained in:
parent
d471c49700
commit
1ac417edb8
1 changed files with 19 additions and 20 deletions
|
@ -78,11 +78,6 @@ namespace {
|
||||||
: 2 * VALUE_INFINITE;
|
: 2 * VALUE_INFINITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int futility_move_count(Depth d) {
|
|
||||||
|
|
||||||
return d < 16 * ONE_PLY ? FutilityMoveCounts[d] : MAX_MOVES;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reduction lookup tables (initialized at startup) and their access function
|
// Reduction lookup tables (initialized at startup) and their access function
|
||||||
int8_t Reductions[2][64][64]; // [pv][depth][moveNumber]
|
int8_t Reductions[2][64][64]; // [pv][depth][moveNumber]
|
||||||
|
|
||||||
|
@ -640,10 +635,10 @@ namespace {
|
||||||
&& !ss->skipNullMove
|
&& !ss->skipNullMove
|
||||||
&& depth < 4 * ONE_PLY
|
&& depth < 4 * ONE_PLY
|
||||||
&& !inCheck
|
&& !inCheck
|
||||||
&& refinedValue - futility_margin(depth, 0) >= beta
|
&& refinedValue - FutilityMargins[depth][0] >= beta
|
||||||
&& abs(beta) < VALUE_MATE_IN_MAX_PLY
|
&& abs(beta) < VALUE_MATE_IN_MAX_PLY
|
||||||
&& pos.non_pawn_material(pos.side_to_move()))
|
&& pos.non_pawn_material(pos.side_to_move()))
|
||||||
return refinedValue - futility_margin(depth, 0);
|
return refinedValue - FutilityMargins[depth][0];
|
||||||
|
|
||||||
// Step 8. Null move search with verification search (is omitted in PV nodes)
|
// Step 8. Null move search with verification search (is omitted in PV nodes)
|
||||||
if ( !PvNode
|
if ( !PvNode
|
||||||
|
@ -768,7 +763,7 @@ split_point_start: // At split points actual search starts from here
|
||||||
|
|
||||||
// Step 11. Loop through moves
|
// Step 11. Loop through moves
|
||||||
// Loop through all pseudo-legal moves until no moves remain or a beta cutoff occurs
|
// Loop through all pseudo-legal moves until no moves remain or a beta cutoff occurs
|
||||||
while (bestValue < beta && (move = mp.next_move<SpNode>()) != MOVE_NONE)
|
while ((move = mp.next_move<SpNode>()) != MOVE_NONE)
|
||||||
{
|
{
|
||||||
assert(is_ok(move));
|
assert(is_ok(move));
|
||||||
|
|
||||||
|
@ -849,7 +844,8 @@ split_point_start: // At split points actual search starts from here
|
||||||
&& (bestValue > VALUE_MATED_IN_MAX_PLY || bestValue == -VALUE_INFINITE))
|
&& (bestValue > VALUE_MATED_IN_MAX_PLY || bestValue == -VALUE_INFINITE))
|
||||||
{
|
{
|
||||||
// Move count based pruning
|
// Move count based pruning
|
||||||
if ( moveCount >= futility_move_count(depth)
|
if ( depth < 16 * ONE_PLY
|
||||||
|
&& moveCount >= FutilityMoveCounts[depth]
|
||||||
&& (!threatMove || !connected_threat(pos, move, threatMove)))
|
&& (!threatMove || !connected_threat(pos, move, threatMove)))
|
||||||
{
|
{
|
||||||
if (SpNode)
|
if (SpNode)
|
||||||
|
@ -981,23 +977,23 @@ split_point_start: // At split points actual search starts from here
|
||||||
if (value > bestValue)
|
if (value > bestValue)
|
||||||
{
|
{
|
||||||
bestValue = value;
|
bestValue = value;
|
||||||
|
if (SpNode) sp->bestValue = value;
|
||||||
|
|
||||||
if (value > alpha)
|
if (value > alpha)
|
||||||
{
|
{
|
||||||
bestMove = move;
|
bestMove = move;
|
||||||
|
if (SpNode) sp->bestMove = move;
|
||||||
|
|
||||||
if (PvNode && value < beta)
|
if (PvNode && value < beta)
|
||||||
alpha = bestValue; // Update alpha here! Always alpha < beta
|
{
|
||||||
}
|
alpha = value; // Update alpha here! Always alpha < beta
|
||||||
|
if (SpNode) sp->alpha = alpha;
|
||||||
if (SpNode)
|
}
|
||||||
{
|
else // Fail high
|
||||||
sp->bestValue = bestValue;
|
{
|
||||||
sp->bestMove = bestMove;
|
if (SpNode) sp->cutoff = true;
|
||||||
sp->alpha = alpha;
|
break;
|
||||||
|
}
|
||||||
if (bestValue >= beta)
|
|
||||||
sp->cutoff = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1006,8 +1002,11 @@ split_point_start: // At split points actual search starts from here
|
||||||
&& depth >= Threads.min_split_depth()
|
&& depth >= Threads.min_split_depth()
|
||||||
&& bestValue < beta
|
&& bestValue < beta
|
||||||
&& Threads.available_slave_exists(thisThread))
|
&& Threads.available_slave_exists(thisThread))
|
||||||
|
{
|
||||||
bestValue = Threads.split<FakeSplit>(pos, ss, alpha, beta, bestValue, &bestMove,
|
bestValue = Threads.split<FakeSplit>(pos, ss, alpha, beta, bestValue, &bestMove,
|
||||||
depth, threatMove, moveCount, mp, NT);
|
depth, threatMove, moveCount, mp, NT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SpNode)
|
if (SpNode)
|
||||||
|
|
Loading…
Add table
Reference in a new issue