mirror of
https://github.com/sockspls/badfish
synced 2025-07-13 12:39:16 +00:00
Do not prune useless checks in QS
Passed both SPRT tests in "simplification mode", so with elo0: -3.00 alpha: 0.05 elo1: 3.00 beta: 0.05 Short TC: LLR: 2.96 (-2.94,2.94) Total: 6243 W: 1302 L: 1195 D: 3746 Long TC LLR: 2.96 (-2.94,2.94) Total: 22972 W: 4124 L: 4020 D: 14828 bench: 4633330
This commit is contained in:
parent
a30d3571ca
commit
10b53e1c5e
1 changed files with 0 additions and 47 deletions
|
@ -99,7 +99,6 @@ namespace {
|
|||
void id_loop(Position& pos);
|
||||
Value value_to_tt(Value v, int ply);
|
||||
Value value_from_tt(Value v, int ply);
|
||||
bool check_is_dangerous(const Position& pos, Move move, Value futilityBase, Value beta);
|
||||
bool allows(const Position& pos, Move first, Move second);
|
||||
bool refutes(const Position& pos, Move first, Move second);
|
||||
string uci_pv(const Position& pos, int depth, Value alpha, Value beta);
|
||||
|
@ -1267,16 +1266,6 @@ moves_loop: // When in check and at SpNode search starts from here
|
|||
&& pos.see_sign(move) < 0)
|
||||
continue;
|
||||
|
||||
// Don't search useless checks
|
||||
if ( !PvNode
|
||||
&& !InCheck
|
||||
&& givesCheck
|
||||
&& move != ttMove
|
||||
&& !pos.is_capture_or_promotion(move)
|
||||
&& ss->staticEval + PawnValueMg / 4 < beta
|
||||
&& !check_is_dangerous(pos, move, futilityBase, beta))
|
||||
continue;
|
||||
|
||||
// Check for legality only before to do the move
|
||||
if (!pos.pl_move_is_legal(move, ci.pinned))
|
||||
continue;
|
||||
|
@ -1354,42 +1343,6 @@ moves_loop: // When in check and at SpNode search starts from here
|
|||
}
|
||||
|
||||
|
||||
// check_is_dangerous() tests if a checking move can be pruned in qsearch()
|
||||
|
||||
bool check_is_dangerous(const Position& pos, Move move, Value futilityBase, Value beta)
|
||||
{
|
||||
Piece pc = pos.piece_moved(move);
|
||||
Square from = from_sq(move);
|
||||
Square to = to_sq(move);
|
||||
Color them = ~pos.side_to_move();
|
||||
Square ksq = pos.king_square(them);
|
||||
Bitboard enemies = pos.pieces(them);
|
||||
Bitboard kingAtt = pos.attacks_from<KING>(ksq);
|
||||
Bitboard occ = pos.pieces() ^ from ^ ksq;
|
||||
Bitboard oldAtt = pos.attacks_from(pc, from, occ);
|
||||
Bitboard newAtt = pos.attacks_from(pc, to, occ);
|
||||
|
||||
// Checks which give opponent's king at most one escape square are dangerous
|
||||
if (!more_than_one(kingAtt & ~(enemies | newAtt | to)))
|
||||
return true;
|
||||
|
||||
// Queen contact check is very dangerous
|
||||
if (type_of(pc) == QUEEN && (kingAtt & to))
|
||||
return true;
|
||||
|
||||
// Creating new double threats with checks is dangerous
|
||||
Bitboard b = (enemies ^ ksq) & newAtt & ~oldAtt;
|
||||
while (b)
|
||||
{
|
||||
// Note that here we generate illegal "double move"!
|
||||
if (futilityBase + PieceValue[EG][pos.piece_on(pop_lsb(&b))] >= beta)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// allows() tests whether the 'first' move at previous ply somehow makes the
|
||||
// 'second' move possible, for instance if the moving piece is the same in
|
||||
// both moves. Normally the second move is the threat (the best move returned
|
||||
|
|
Loading…
Add table
Reference in a new issue