1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00

Relax constrain in prevents_threat()

When testing if a move blocks the threat path there is no
reason to require the threat to be a slider. Indeed threat
can be a double pawn push like in this example:

r1bq1rk1/ppp1np1p/4n1p1/3p4/3P2Q1/2P1B3/PPBN2PP/R4RK1 w - - 0 16

Where white's move Rf6 blocks the threat f5.

As a nice side effect we can retire the now useless helper
piece_is_slider().

This patch kicks in only very rare cases, indeed the bench is
still the same!

bench: 5809010
This commit is contained in:
Marco Costalba 2012-11-03 15:48:34 +01:00
parent 47f988f05f
commit dd5b3086f5

View file

@ -62,10 +62,6 @@ namespace {
// Different node types, used as template parameter
enum NodeType { Root, PV, NonPV, SplitPointRoot, SplitPointPV, SplitPointNonPV };
// Lookup table to check if a Piece is a slider and its access function
const bool Slidings[18] = { 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1 };
inline bool piece_is_slider(Piece p) { return Slidings[p]; }
// Dynamic razoring margin based on depth
inline Value razor_margin(Depth d) { return Value(512 + 16 * int(d)); }
@ -1437,10 +1433,8 @@ split_point_start: // At split points actual search starts from here
return true;
}
// If the threat piece is a slider, don't prune safe moves which block it
if ( piece_is_slider(pos.piece_on(tfrom))
&& (between_bb(tfrom, tto) & mto)
&& pos.see_sign(move) >= 0)
// Don't prune safe moves which block the threat path
if ((between_bb(tfrom, tto) & mto) && pos.see_sign(move) >= 0)
return true;
return false;