mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Revert "Don't prune discovered checks"
Both Lucas re-test and Jean-Francois confirrm it is a regression. Here Jean-Francois's results after 3600 games : Score of96d3b1c92b
vs3b87314
: 690 - 729 - 2181 [0.495] 3600 ELO: -3.86 +- 99%: 14.94 95%: 11.35 LOS: 15.03% Wins: 690 Losses: 729 Draws: 2181 Total: 3600 Bench: 5404066
This commit is contained in:
parent
96d3b1c92b
commit
c45a4e0b48
4 changed files with 12 additions and 22 deletions
|
@ -657,7 +657,7 @@ bool Position::is_pseudo_legal(const Move m) const {
|
||||||
|
|
||||||
/// Position::move_gives_check() tests whether a pseudo-legal move gives a check
|
/// Position::move_gives_check() tests whether a pseudo-legal move gives a check
|
||||||
|
|
||||||
CheckType Position::move_gives_check(Move m, const CheckInfo& ci) const {
|
bool Position::move_gives_check(Move m, const CheckInfo& ci) const {
|
||||||
|
|
||||||
assert(is_ok(m));
|
assert(is_ok(m));
|
||||||
assert(ci.dcCandidates == discovered_check_candidates());
|
assert(ci.dcCandidates == discovered_check_candidates());
|
||||||
|
@ -669,7 +669,7 @@ CheckType Position::move_gives_check(Move m, const CheckInfo& ci) const {
|
||||||
|
|
||||||
// Direct check ?
|
// Direct check ?
|
||||||
if (ci.checkSq[pt] & to)
|
if (ci.checkSq[pt] & to)
|
||||||
return DIRECT_CHECK;
|
return true;
|
||||||
|
|
||||||
// Discovery check ?
|
// Discovery check ?
|
||||||
if (ci.dcCandidates && (ci.dcCandidates & from))
|
if (ci.dcCandidates && (ci.dcCandidates & from))
|
||||||
|
@ -677,19 +677,19 @@ CheckType Position::move_gives_check(Move m, const CheckInfo& ci) const {
|
||||||
// For pawn and king moves we need to verify also direction
|
// For pawn and king moves we need to verify also direction
|
||||||
if ( (pt != PAWN && pt != KING)
|
if ( (pt != PAWN && pt != KING)
|
||||||
|| !squares_aligned(from, to, king_square(~sideToMove)))
|
|| !squares_aligned(from, to, king_square(~sideToMove)))
|
||||||
return DISCO_CHECK;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can we skip the ugly special cases ?
|
// Can we skip the ugly special cases ?
|
||||||
if (type_of(m) == NORMAL)
|
if (type_of(m) == NORMAL)
|
||||||
return NO_CHECK;
|
return false;
|
||||||
|
|
||||||
Color us = sideToMove;
|
Color us = sideToMove;
|
||||||
Square ksq = king_square(~us);
|
Square ksq = king_square(~us);
|
||||||
|
|
||||||
// Promotion with check ?
|
// Promotion with check ?
|
||||||
if (type_of(m) == PROMOTION)
|
if (type_of(m) == PROMOTION)
|
||||||
return attacks_from(Piece(promotion_type(m)), to, pieces() ^ from) & ksq ? DIRECT_CHECK : NO_CHECK;
|
return attacks_from(Piece(promotion_type(m)), to, pieces() ^ from) & ksq;
|
||||||
|
|
||||||
// En passant capture with check ? We have already handled the case
|
// En passant capture with check ? We have already handled the case
|
||||||
// of direct checks and ordinary discovered check, the only case we
|
// of direct checks and ordinary discovered check, the only case we
|
||||||
|
@ -701,7 +701,7 @@ CheckType Position::move_gives_check(Move m, const CheckInfo& ci) const {
|
||||||
Bitboard b = (pieces() ^ from ^ capsq) | to;
|
Bitboard b = (pieces() ^ from ^ capsq) | to;
|
||||||
|
|
||||||
return (attacks_bb< ROOK>(ksq, b) & pieces(us, QUEEN, ROOK))
|
return (attacks_bb< ROOK>(ksq, b) & pieces(us, QUEEN, ROOK))
|
||||||
| (attacks_bb<BISHOP>(ksq, b) & pieces(us, QUEEN, BISHOP)) ? DISCO_CHECK : NO_CHECK;
|
| (attacks_bb<BISHOP>(ksq, b) & pieces(us, QUEEN, BISHOP));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Castling with check ?
|
// Castling with check ?
|
||||||
|
@ -713,10 +713,10 @@ CheckType Position::move_gives_check(Move m, const CheckInfo& ci) const {
|
||||||
Square rto = relative_square(us, rfrom > kfrom ? SQ_F1 : SQ_D1);
|
Square rto = relative_square(us, rfrom > kfrom ? SQ_F1 : SQ_D1);
|
||||||
Bitboard b = (pieces() ^ kfrom ^ rfrom) | rto | kto;
|
Bitboard b = (pieces() ^ kfrom ^ rfrom) | rto | kto;
|
||||||
|
|
||||||
return attacks_bb<ROOK>(rto, b) & ksq ? DIRECT_CHECK : NO_CHECK;
|
return attacks_bb<ROOK>(rto, b) & ksq;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NO_CHECK;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ public:
|
||||||
template<PieceType> Bitboard attacks_from(Square s, Color c) const;
|
template<PieceType> Bitboard attacks_from(Square s, Color c) const;
|
||||||
|
|
||||||
// Properties of moves
|
// Properties of moves
|
||||||
CheckType move_gives_check(Move m, const CheckInfo& ci) const;
|
bool move_gives_check(Move m, const CheckInfo& ci) const;
|
||||||
bool move_is_legal(const Move m) const;
|
bool move_is_legal(const Move m) const;
|
||||||
bool pl_move_is_legal(Move m, Bitboard pinned) const;
|
bool pl_move_is_legal(Move m, Bitboard pinned) const;
|
||||||
bool is_pseudo_legal(const Move m) const;
|
bool is_pseudo_legal(const Move m) const;
|
||||||
|
|
|
@ -483,8 +483,7 @@ namespace {
|
||||||
Depth ext, newDepth;
|
Depth ext, newDepth;
|
||||||
Value bestValue, value, ttValue;
|
Value bestValue, value, ttValue;
|
||||||
Value eval, nullValue, futilityValue;
|
Value eval, nullValue, futilityValue;
|
||||||
CheckType givesCheck;
|
bool inCheck, givesCheck, pvMove, singularExtensionNode;
|
||||||
bool inCheck, pvMove, singularExtensionNode;
|
|
||||||
bool captureOrPromotion, dangerous, doFullDepthSearch;
|
bool captureOrPromotion, dangerous, doFullDepthSearch;
|
||||||
int moveCount, playedMoveCount;
|
int moveCount, playedMoveCount;
|
||||||
|
|
||||||
|
@ -816,7 +815,7 @@ split_point_start: // At split points actual search starts from here
|
||||||
if (PvNode && dangerous)
|
if (PvNode && dangerous)
|
||||||
ext = ONE_PLY;
|
ext = ONE_PLY;
|
||||||
|
|
||||||
else if (givesCheck && (givesCheck == DISCO_CHECK || pos.see_sign(move) >= 0))
|
else if (givesCheck && pos.see_sign(move) >= 0)
|
||||||
ext = ONE_PLY / 2;
|
ext = ONE_PLY / 2;
|
||||||
|
|
||||||
// Singular extension search. If all moves but one fail low on a search of
|
// Singular extension search. If all moves but one fail low on a search of
|
||||||
|
@ -883,7 +882,6 @@ split_point_start: // At split points actual search starts from here
|
||||||
|
|
||||||
// Prune moves with negative SEE at low depths
|
// Prune moves with negative SEE at low depths
|
||||||
if ( predictedDepth < 2 * ONE_PLY
|
if ( predictedDepth < 2 * ONE_PLY
|
||||||
&& givesCheck != DISCO_CHECK
|
|
||||||
&& pos.see_sign(move) < 0)
|
&& pos.see_sign(move) < 0)
|
||||||
{
|
{
|
||||||
if (SpNode)
|
if (SpNode)
|
||||||
|
@ -1104,8 +1102,7 @@ split_point_start: // At split points actual search starts from here
|
||||||
Key posKey;
|
Key posKey;
|
||||||
Move ttMove, move, bestMove;
|
Move ttMove, move, bestMove;
|
||||||
Value bestValue, value, ttValue, futilityValue, futilityBase;
|
Value bestValue, value, ttValue, futilityValue, futilityBase;
|
||||||
CheckType givesCheck;
|
bool givesCheck, enoughMaterial, evasionPrunable, fromNull;
|
||||||
bool enoughMaterial, evasionPrunable, fromNull;
|
|
||||||
Depth ttDepth;
|
Depth ttDepth;
|
||||||
|
|
||||||
ss->currentMove = bestMove = MOVE_NONE;
|
ss->currentMove = bestMove = MOVE_NONE;
|
||||||
|
@ -1237,7 +1234,6 @@ split_point_start: // At split points actual search starts from here
|
||||||
if ( !PvNode
|
if ( !PvNode
|
||||||
&& (!InCheck || evasionPrunable)
|
&& (!InCheck || evasionPrunable)
|
||||||
&& move != ttMove
|
&& move != ttMove
|
||||||
&& givesCheck != DISCO_CHECK
|
|
||||||
&& type_of(move) != PROMOTION
|
&& type_of(move) != PROMOTION
|
||||||
&& pos.see_sign(move) < 0)
|
&& pos.see_sign(move) < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -130,12 +130,6 @@ enum MoveType {
|
||||||
CASTLE = 3 << 14
|
CASTLE = 3 << 14
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CheckType {
|
|
||||||
NO_CHECK,
|
|
||||||
DIRECT_CHECK,
|
|
||||||
DISCO_CHECK
|
|
||||||
};
|
|
||||||
|
|
||||||
enum CastleRight { // Defined as in PolyGlot book hash key
|
enum CastleRight { // Defined as in PolyGlot book hash key
|
||||||
CASTLES_NONE = 0,
|
CASTLES_NONE = 0,
|
||||||
WHITE_OO = 1,
|
WHITE_OO = 1,
|
||||||
|
|
Loading…
Add table
Reference in a new issue