#include "movepick.h"
#include "position.h"
#include "search.h"
-#include "timeman.h"
#include "thread.h"
+#include "timeman.h"
#include "tt.h"
#include "uci.h"
#include "syzygy/tbprobe.h"
// Step 7. Razoring (skipped when in check)
if ( !PvNode
- && depth <= 2 * ONE_PLY
- && eval <= alpha - Value(RazorMargin[depth / ONE_PLY]))
+ && depth < 3 * ONE_PLY
+ && eval <= alpha - RazorMargin[depth / ONE_PLY])
{
- Value ralpha = alpha - Value((depth != ONE_PLY) * RazorMargin[depth / ONE_PLY]);
+ Value ralpha = alpha - (depth >= 2 * ONE_PLY) * RazorMargin[depth / ONE_PLY];
Value v = qsearch<NonPV>(pos, ss, ralpha, ralpha+1);
- if (depth == ONE_PLY || v <= ralpha)
+ if (depth < 2 * ONE_PLY || v <= ralpha)
return v;
}
Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth) {
constexpr bool PvNode = NT == PV;
- const bool inCheck = bool(pos.checkers());
assert(alpha >= -VALUE_INFINITE && alpha < beta && beta <= VALUE_INFINITE);
assert(PvNode || (alpha == beta - 1));
Move ttMove, move, bestMove;
Depth ttDepth;
Value bestValue, value, ttValue, futilityValue, futilityBase, oldAlpha;
- bool ttHit, givesCheck, evasionPrunable;
+ bool ttHit, inCheck, givesCheck, evasionPrunable;
int moveCount;
if (PvNode)
(ss+1)->ply = ss->ply + 1;
ss->currentMove = bestMove = MOVE_NONE;
+ inCheck = pos.checkers();
moveCount = 0;
// Check for an immediate draw or maximum ply reached