mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Assorted pruning tweaks
LTC: LLR: 2.95 (-2.94,2.94) [0.00,5.00] Total: 38257 W: 5206 L: 4961 D: 28090 STC: LLR: 2.95 (-2.94,2.94) [0.00,5.00] Total: 16550 W: 3110 L: 2914 D: 10526 Bench: 8428997
This commit is contained in:
parent
0784bd542b
commit
7cb8cbb403
1 changed files with 15 additions and 13 deletions
|
@ -609,6 +609,7 @@ namespace {
|
|||
Value bestValue, value, ttValue, eval, nullValue, futilityValue;
|
||||
bool ttHit, inCheck, givesCheck, singularExtensionNode, improving;
|
||||
bool captureOrPromotion, doFullDepthSearch;
|
||||
Piece moved_piece;
|
||||
int moveCount, quietCount;
|
||||
|
||||
// Step 1. Initialize node
|
||||
|
@ -864,7 +865,9 @@ namespace {
|
|||
moves_loop: // When in check search starts from here
|
||||
|
||||
Square prevSq = to_sq((ss-1)->currentMove);
|
||||
const CounterMoveStats& cmh = CounterMoveHistory[pos.piece_on(prevSq)][prevSq];
|
||||
const CounterMoveStats* cmh = (ss-1)->counterMoves;
|
||||
const CounterMoveStats* fmh = (ss-2)->counterMoves;
|
||||
const CounterMoveStats* fmh2 = (ss-4)->counterMoves;
|
||||
|
||||
MovePicker mp(pos, ttMove, depth, ss);
|
||||
CheckInfo ci(pos);
|
||||
|
@ -910,6 +913,7 @@ moves_loop: // When in check search starts from here
|
|||
|
||||
extension = DEPTH_ZERO;
|
||||
captureOrPromotion = pos.capture_or_promotion(move);
|
||||
moved_piece = pos.moved_piece(move);
|
||||
|
||||
givesCheck = type_of(move) == NORMAL && !ci.dcCandidates
|
||||
? ci.checkSquares[type_of(pos.piece_on(from_sq(move)))] & to_sq(move)
|
||||
|
@ -956,11 +960,12 @@ moves_loop: // When in check search starts from here
|
|||
&& moveCount >= FutilityMoveCounts[improving][depth])
|
||||
continue;
|
||||
|
||||
// History based pruning
|
||||
// Countermoves based pruning
|
||||
if ( depth <= 4 * ONE_PLY
|
||||
&& move != ss->killers[0]
|
||||
&& thisThread->history[pos.moved_piece(move)][to_sq(move)] < VALUE_ZERO
|
||||
&& cmh[pos.moved_piece(move)][to_sq(move)] < VALUE_ZERO)
|
||||
&& (!cmh || (*cmh )[moved_piece][to_sq(move)] < VALUE_ZERO)
|
||||
&& (!fmh || (*fmh )[moved_piece][to_sq(move)] < VALUE_ZERO)
|
||||
&& (!fmh2 || (*fmh2)[moved_piece][to_sq(move)] < VALUE_ZERO || (cmh && fmh)))
|
||||
continue;
|
||||
|
||||
predictedDepth = std::max(newDepth - reduction<PvNode>(improving, depth, moveCount), DEPTH_ZERO);
|
||||
|
@ -993,7 +998,7 @@ moves_loop: // When in check search starts from here
|
|||
}
|
||||
|
||||
ss->currentMove = move;
|
||||
ss->counterMoves = &CounterMoveHistory[pos.moved_piece(move)][to_sq(move)];
|
||||
ss->counterMoves = &CounterMoveHistory[moved_piece][to_sq(move)];
|
||||
|
||||
// Step 14. Make the move
|
||||
pos.do_move(move, st, givesCheck);
|
||||
|
@ -1005,20 +1010,17 @@ moves_loop: // When in check search starts from here
|
|||
&& !captureOrPromotion)
|
||||
{
|
||||
Depth r = reduction<PvNode>(improving, depth, moveCount);
|
||||
Value hValue = thisThread->history[pos.piece_on(to_sq(move))][to_sq(move)];
|
||||
Value cmhValue = cmh[pos.piece_on(to_sq(move))][to_sq(move)];
|
||||
|
||||
const CounterMoveStats* fm = (ss - 2)->counterMoves;
|
||||
const CounterMoveStats* fm2 = (ss - 4)->counterMoves;
|
||||
Value fmValue = (fm ? (*fm)[pos.piece_on(to_sq(move))][to_sq(move)] : VALUE_ZERO);
|
||||
Value fm2Value = (fm2 ? (*fm2)[pos.piece_on(to_sq(move))][to_sq(move)] : VALUE_ZERO);
|
||||
Value val = thisThread->history[moved_piece][to_sq(move)]
|
||||
+ (cmh ? (*cmh )[moved_piece][to_sq(move)] : VALUE_ZERO)
|
||||
+ (fmh ? (*fmh )[moved_piece][to_sq(move)] : VALUE_ZERO)
|
||||
+ (fmh2 ? (*fmh2)[moved_piece][to_sq(move)] : VALUE_ZERO);
|
||||
|
||||
// Increase reduction for cut nodes
|
||||
if (!PvNode && cutNode)
|
||||
r += ONE_PLY;
|
||||
|
||||
// Decrease/increase reduction for moves with a good/bad history
|
||||
int rHist = (hValue + cmhValue + fmValue + fm2Value - 10000) / 20000;
|
||||
int rHist = (val - 10000) / 20000;
|
||||
r = std::max(DEPTH_ZERO, r - rHist * ONE_PLY);
|
||||
|
||||
// Decrease reduction for moves that escape a capture. Filter out
|
||||
|
|
Loading…
Add table
Reference in a new issue