Skip to content

Commit

Permalink
Improvement attempt 4(over passed patch official-stockfish#4453), inc…
Browse files Browse the repository at this point in the history
…lude Bishops/Knights

Hit #0: Total 18031 Hits 335 Hit Rate (%) 1.85791  King
Hit #1: Total 18031 Hits 4616 Hit Rate (%) 25.6004  Queen
Hit #2: Total 18031 Hits 3916 Hit Rate (%) 21.7182  Rook
Hit official-stockfish#3: Total 18031 Hits 2766 Hit Rate (%) 15.3402  Bishop
Hit official-stockfish#4: Total 18031 Hits 6398 Hit Rate (%) 35.4833  Knight

bench: 4868464
  • Loading branch information
pb00068 committed Mar 23, 2023
1 parent 3b51c7c commit da764eb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,6 @@ namespace {
moveCount = captureCount = quietCount = ss->moveCount = 0;
bestValue = -VALUE_INFINITE;
maxValue = VALUE_INFINITE;
ss->threatenedPieces = 0;

// Check for the available remaining time
if (thisThread == Threads.main())
Expand Down Expand Up @@ -990,8 +989,6 @@ namespace {
movedPiece = pos.moved_piece(move);
givesCheck = pos.gives_check(move);

ss->threatenedPieces |= mp.threatenedPieces;

// Calculate new depth for this move
newDepth = depth - 1;

Expand Down Expand Up @@ -1026,15 +1023,21 @@ namespace {
// SEE based pruning (~11 Elo)
if (!pos.see_ge(move, occupied, Value(-206) * depth))
{
if (depth < 2 - capture)
if (depth < 3 - 2 * capture)
continue;
// don't prune move if a enemy piece (KQRB) is under attack after the exchanges
// exclude a priori already threatened Pieces
Bitboard leftEnemies = (pos.pieces(~us, QUEEN, ROOK) | pos.pieces(~us, KING, BISHOP)) & occupied & ~(ss-1)->threatenedPieces;
Bitboard leftEnemies = (pos.pieces(~us) ^ pos.pieces(~us, PAWN)) & occupied;
Bitboard attacks = 0;
occupied |= to_sq(move);
while (leftEnemies && !attacks)
attacks = pos.slider_attackers_to(pop_lsb(leftEnemies), occupied) & pos.pieces(us) & occupied;
{
Square sq = pop_lsb(leftEnemies);
attacks = pos.slider_attackers_to(sq, occupied) & pos.pieces(us) & occupied;
// exclude attacks which were already there before SEE-exchanges
if (attacks && (sq != pos.square<KING>(~us) && (pos.slider_attackers_to(sq, pos.pieces()) & pos.pieces(us))))
attacks = 0;
}
if (!attacks)
continue;
}
Expand Down
1 change: 0 additions & 1 deletion src/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ struct Stack {
bool ttHit;
int doubleExtensions;
int cutoffCnt;
Bitboard threatenedPieces;
};


Expand Down

0 comments on commit da764eb

Please sign in to comment.