Simply return a fail-low score
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
{
lock_grab(&(sp->lock));
bestValue = sp->bestValue;
{
lock_grab(&(sp->lock));
bestValue = sp->bestValue;
+ moveCount = sp->moveCount;
+
+ assert(bestValue > -VALUE_INFINITE && moveCount > 0);
}
// Step 11. Loop through moves
}
// Step 11. Loop through moves
if (futilityValue < beta)
{
if (SpNode)
if (futilityValue < beta)
{
if (SpNode)
- if (futilityValue > sp->bestValue)
- sp->bestValue = bestValue = futilityValue;
- }
- else if (futilityValue > bestValue)
- bestValue = futilityValue;
// case of StopRequest or thread.cutoff_occurred() are set, but this is
// harmless because return value is discarded anyhow in the parent nodes.
// If we are in a singular extension search then return a fail low score.
// case of StopRequest or thread.cutoff_occurred() are set, but this is
// harmless because return value is discarded anyhow in the parent nodes.
// If we are in a singular extension search then return a fail low score.
- if (!SpNode && !moveCount)
return excludedMove ? oldAlpha : inCheck ? value_mated_in(ss->ply) : VALUE_DRAW;
return excludedMove ? oldAlpha : inCheck ? value_mated_in(ss->ply) : VALUE_DRAW;
+ // We have pruned all the moves, so return a fail-low score
+ if (bestValue == -VALUE_INFINITE)
+ {
+ assert(!playedMoveCount);
+
+ bestValue = alpha;
+ }
+
// Step 21. Update tables
// If the search is not aborted, update the transposition table,
// history counters, and killer moves.
// Step 21. Update tables
// If the search is not aborted, update the transposition table,
// history counters, and killer moves.
Value bestValue, Depth depth, Move threatMove,
int moveCount, MovePicker* mp, int nodeType) {
assert(pos.pos_is_ok());
Value bestValue, Depth depth, Move threatMove,
int moveCount, MovePicker* mp, int nodeType) {
assert(pos.pos_is_ok());
- assert(bestValue >= -VALUE_INFINITE);
+ assert(bestValue > -VALUE_INFINITE);
assert(bestValue <= alpha);
assert(alpha < beta);
assert(beta <= VALUE_INFINITE);
assert(bestValue <= alpha);
assert(alpha < beta);
assert(beta <= VALUE_INFINITE);