mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Bug fix for KQKRPs endgame
This lost position 8/8/3q4/8/5k2/2P1R3/2K2P2/8 w - - 0 1 was previously evaluated as a draw. The king and rook need to be correctly placed with respect to the _same_ pawn. (Note also that the check for the pawn being on RANK_2 in the old version is redundant: it must be on RANK_2 if it hopes to protect a rook on RANK_3) Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
5aeb907fa1
commit
2bf18bfc63
1 changed files with 4 additions and 4 deletions
|
@ -464,10 +464,10 @@ ScaleFactor Endgame<KQKRPs>::operator()(const Position& pos) const {
|
||||||
|
|
||||||
if ( relative_rank(weakSide, kingSq) <= RANK_2
|
if ( relative_rank(weakSide, kingSq) <= RANK_2
|
||||||
&& relative_rank(weakSide, pos.king_square(strongSide)) >= RANK_4
|
&& relative_rank(weakSide, pos.king_square(strongSide)) >= RANK_4
|
||||||
&& (pos.pieces(weakSide, ROOK) & rank_bb(relative_rank(weakSide, RANK_3)))
|
&& relative_rank(weakSide, rsq) == RANK_3
|
||||||
&& (pos.pieces(weakSide, PAWN) & rank_bb(relative_rank(weakSide, RANK_2)))
|
&& ( pos.pieces(weakSide, PAWN)
|
||||||
&& (pos.attacks_from<KING>(kingSq) & pos.pieces(weakSide, PAWN))
|
& pos.attacks_from<KING>(kingSq)
|
||||||
&& (pos.attacks_from<PAWN>(rsq, strongSide) & pos.pieces(weakSide, PAWN)))
|
& pos.attacks_from<PAWN>(rsq, strongSide)))
|
||||||
return SCALE_FACTOR_DRAW;
|
return SCALE_FACTOR_DRAW;
|
||||||
|
|
||||||
return SCALE_FACTOR_NONE;
|
return SCALE_FACTOR_NONE;
|
||||||
|
|
Loading…
Add table
Reference in a new issue