diff --git a/source/move.h b/source/move.h index 0f04047..6a0e7aa 100644 --- a/source/move.h +++ b/source/move.h @@ -49,12 +49,17 @@ public: return m_move >> 12; } - int IsCapture() { + bool IsCapture() { return (GetFlags() == capture || GetFlags() == epCapture || GetFlags() == knightPromoCapture || GetFlags() == bishopPromoCapture || GetFlags() == rookPromoCapture || GetFlags() == queenPromoCapture); } + bool IsQuiet() { + return (GetFlags() == quiet || GetFlags() == kingCastle + || GetFlags() == queenCastle || GetFlags() == doublePawnPush); + } + void PrintMove() { std::cout << squareCoords[MoveFrom()] << squareCoords[MoveTo()]; diff --git a/source/search.cpp b/source/search.cpp index 4730f4c..fcd8c81 100644 --- a/source/search.cpp +++ b/source/search.cpp @@ -236,6 +236,16 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply) { if (!isLegal) continue; + // Futility pruning + // If our static eval is far below alpha, there is only a small chance + // that a quiet move will help us so we skip them + int fpMargin = 100; + if (!isPV && !board.InCheck() && currMove.IsQuiet() + && depth <= 2 && staticEval + fpMargin < alpha) { + positionIndex--; + continue; + } + int reductions = GetReductions(board, currMove, depth, moveSeen, ply); // First move (suspected PV node)