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

Minor improvement in eval of unstoppable pawns promoting one ply apart.

Marco's new code for evaluating two unstoppable passed pawns where
one pawn promotes a single ply before the other tried to detect
cases where the pawn that promotes first could immediately capture
the pawn that promotes a ply later, but didn't work in cases where
the two pawns are on the same file. An example of this is the
following position:

8/8/3K4/2P5/2p5/3k4/8/8 w - -

With the new code, such positions are handled correctly.
This commit is contained in:
Tord Romstad 2009-10-15 12:39:55 +02:00
parent d8e7ce1863
commit 53f882ff1a

View file

@ -1069,7 +1069,10 @@ namespace {
Square winnerQSq = relative_square(winnerSide, make_square(square_file(pawnToGo[winnerSide]), RANK_8)); Square winnerQSq = relative_square(winnerSide, make_square(square_file(pawnToGo[winnerSide]), RANK_8));
Square loserQSq = relative_square(loserSide, make_square(square_file(pawnToGo[loserSide]), RANK_8)); Square loserQSq = relative_square(loserSide, make_square(square_file(pawnToGo[loserSide]), RANK_8));
Bitboard b = pos.attacks_from<QUEEN>(winnerQSq); Bitboard b = pos.occupied_squares();
clear_bit(&b, pawnToGo[winnerSide]);
clear_bit(&b, pawnToGo[loserSide]);
b = queen_attacks_bb(winnerQSq, b);
if ( (b & pos.pieces(KING, loserSide)) if ( (b & pos.pieces(KING, loserSide))
||(bit_is_set(b, loserQSq) && !bit_is_set(ei.attacked_by(loserSide), loserQSq))) ||(bit_is_set(b, loserQSq) && !bit_is_set(ei.attacked_by(loserSide), loserQSq)))