mirror of
https://github.com/sockspls/badfish
synced 2025-07-13 12:39:16 +00:00
Skip quiet moves based on moveCount pruning threshold and history stats
If we can moveCountPrune and next quiet move has negative stats, then go directly to the next move stage (Bad_Captures). Reduction formula is tweaked to compensate for the decrease in move count that is used in LMR. STC: LLR: 2.96 (-2.94,2.94) [0.00,5.00] Total: 6847 W: 1276 L: 1123 D: 4448 LTC: LLR: 2.95 (-2.94,2.94) [0.00,5.00] Total: 48687 W: 6503 L: 6226 D: 35958 Bench: 5919519 Closes #1036
This commit is contained in:
parent
c80d52c845
commit
352bd6f5aa
3 changed files with 12 additions and 7 deletions
|
@ -175,7 +175,7 @@ void MovePicker::score<EVASIONS>() {
|
||||||
/// left. It picks the move with the biggest value from a list of generated moves
|
/// left. It picks the move with the biggest value from a list of generated moves
|
||||||
/// taking care not to return the ttMove if it has already been searched.
|
/// taking care not to return the ttMove if it has already been searched.
|
||||||
|
|
||||||
Move MovePicker::next_move() {
|
Move MovePicker::next_move(bool skipQuiets) {
|
||||||
|
|
||||||
Move move;
|
Move move;
|
||||||
|
|
||||||
|
@ -248,9 +248,11 @@ Move MovePicker::next_move() {
|
||||||
++stage;
|
++stage;
|
||||||
|
|
||||||
case QUIET:
|
case QUIET:
|
||||||
while (cur < endMoves)
|
while ( cur < endMoves
|
||||||
|
&& (!skipQuiets || cur->value >= VALUE_ZERO))
|
||||||
{
|
{
|
||||||
move = *cur++;
|
move = *cur++;
|
||||||
|
|
||||||
if ( move != ttMove
|
if ( move != ttMove
|
||||||
&& move != ss->killers[0]
|
&& move != ss->killers[0]
|
||||||
&& move != ss->killers[1]
|
&& move != ss->killers[1]
|
||||||
|
|
|
@ -95,7 +95,7 @@ public:
|
||||||
MovePicker(const Position&, Move, Depth, Square);
|
MovePicker(const Position&, Move, Depth, Square);
|
||||||
MovePicker(const Position&, Move, Depth, Search::Stack*);
|
MovePicker(const Position&, Move, Depth, Search::Stack*);
|
||||||
|
|
||||||
Move next_move();
|
Move next_move(bool skipQuiets = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<GenType> void score();
|
template<GenType> void score();
|
||||||
|
|
|
@ -163,7 +163,7 @@ void Search::init() {
|
||||||
for (int d = 1; d < 64; ++d)
|
for (int d = 1; d < 64; ++d)
|
||||||
for (int mc = 1; mc < 64; ++mc)
|
for (int mc = 1; mc < 64; ++mc)
|
||||||
{
|
{
|
||||||
double r = log(d) * log(mc) / 2;
|
double r = log(d) * log(mc) / 1.95;
|
||||||
|
|
||||||
Reductions[NonPV][imp][d][mc] = int(std::round(r));
|
Reductions[NonPV][imp][d][mc] = int(std::round(r));
|
||||||
Reductions[PV][imp][d][mc] = std::max(Reductions[NonPV][imp][d][mc] - 1, 0);
|
Reductions[PV][imp][d][mc] = std::max(Reductions[NonPV][imp][d][mc] - 1, 0);
|
||||||
|
@ -542,7 +542,7 @@ namespace {
|
||||||
Depth extension, newDepth;
|
Depth extension, newDepth;
|
||||||
Value bestValue, value, ttValue, eval;
|
Value bestValue, value, ttValue, eval;
|
||||||
bool ttHit, inCheck, givesCheck, singularExtensionNode, improving;
|
bool ttHit, inCheck, givesCheck, singularExtensionNode, improving;
|
||||||
bool captureOrPromotion, doFullDepthSearch, moveCountPruning;
|
bool captureOrPromotion, doFullDepthSearch, moveCountPruning, skipQuiets;
|
||||||
Piece moved_piece;
|
Piece moved_piece;
|
||||||
int moveCount, quietCount;
|
int moveCount, quietCount;
|
||||||
|
|
||||||
|
@ -829,10 +829,11 @@ moves_loop: // When in check search starts from here
|
||||||
&& !excludedMove // Recursive singular search is not allowed
|
&& !excludedMove // Recursive singular search is not allowed
|
||||||
&& (tte->bound() & BOUND_LOWER)
|
&& (tte->bound() & BOUND_LOWER)
|
||||||
&& tte->depth() >= depth - 3 * ONE_PLY;
|
&& tte->depth() >= depth - 3 * ONE_PLY;
|
||||||
|
skipQuiets = false;
|
||||||
|
|
||||||
// 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 ((move = mp.next_move()) != MOVE_NONE)
|
while ((move = mp.next_move(skipQuiets)) != MOVE_NONE)
|
||||||
{
|
{
|
||||||
assert(is_ok(move));
|
assert(is_ok(move));
|
||||||
|
|
||||||
|
@ -906,8 +907,10 @@ moves_loop: // When in check search starts from here
|
||||||
&& (!pos.advanced_pawn_push(move) || pos.non_pawn_material() >= 5000))
|
&& (!pos.advanced_pawn_push(move) || pos.non_pawn_material() >= 5000))
|
||||||
{
|
{
|
||||||
// Move count based pruning
|
// Move count based pruning
|
||||||
if (moveCountPruning)
|
if (moveCountPruning) {
|
||||||
|
skipQuiets = true;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Reduced depth of the next LMR search
|
// Reduced depth of the next LMR search
|
||||||
int lmrDepth = std::max(newDepth - reduction<PvNode>(improving, depth, moveCount), DEPTH_ZERO) / ONE_PLY;
|
int lmrDepth = std::max(newDepth - reduction<PvNode>(improving, depth, moveCount), DEPTH_ZERO) / ONE_PLY;
|
||||||
|
|
Loading…
Add table
Reference in a new issue