mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
qsearch: do not call evaluate when in check
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
a55b06d3c9
commit
bfbfc24d07
1 changed files with 5 additions and 5 deletions
|
@ -1439,14 +1439,15 @@ namespace {
|
||||||
return value_from_tt(tte->value(), ply);
|
return value_from_tt(tte->value(), ply);
|
||||||
|
|
||||||
// Evaluate the position statically
|
// Evaluate the position statically
|
||||||
Value staticValue = evaluate(pos, ei, threadID);
|
bool isCheck = pos.is_check();
|
||||||
|
Value staticValue = (isCheck ? -VALUE_INFINITE : evaluate(pos, ei, threadID));
|
||||||
|
|
||||||
if (ply == PLY_MAX - 1)
|
if (ply == PLY_MAX - 1)
|
||||||
return staticValue;
|
return evaluate(pos, ei, threadID);
|
||||||
|
|
||||||
// Initialize "stand pat score", and return it immediately if it is
|
// Initialize "stand pat score", and return it immediately if it is
|
||||||
// at least beta.
|
// at least beta.
|
||||||
Value bestValue = (pos.is_check() ? -VALUE_INFINITE : staticValue);
|
Value bestValue = staticValue;
|
||||||
|
|
||||||
if (bestValue >= beta)
|
if (bestValue >= beta)
|
||||||
return bestValue;
|
return bestValue;
|
||||||
|
@ -1458,11 +1459,10 @@ namespace {
|
||||||
// to search the moves. Because the depth is <= 0 here, only captures,
|
// to search the moves. Because the depth is <= 0 here, only captures,
|
||||||
// queen promotions and checks (only if depth == 0) will be generated.
|
// queen promotions and checks (only if depth == 0) will be generated.
|
||||||
bool pvNode = (beta - alpha != 1);
|
bool pvNode = (beta - alpha != 1);
|
||||||
MovePicker mp = MovePicker(pos, pvNode, MOVE_NONE, EmptySearchStack, depth, &ei);
|
MovePicker mp = MovePicker(pos, pvNode, MOVE_NONE, EmptySearchStack, depth, isCheck ? NULL : &ei);
|
||||||
Move move;
|
Move move;
|
||||||
int moveCount = 0;
|
int moveCount = 0;
|
||||||
Bitboard dcCandidates = mp.discovered_check_candidates();
|
Bitboard dcCandidates = mp.discovered_check_candidates();
|
||||||
bool isCheck = pos.is_check();
|
|
||||||
bool enoughMaterial = pos.non_pawn_material(pos.side_to_move()) > RookValueMidgame;
|
bool enoughMaterial = pos.non_pawn_material(pos.side_to_move()) > RookValueMidgame;
|
||||||
|
|
||||||
// Loop through the moves until no moves remain or a beta cutoff
|
// Loop through the moves until no moves remain or a beta cutoff
|
||||||
|
|
Loading…
Add table
Reference in a new issue