From 69a14554eebc1467db7234e354bfd864fa46b1b9 Mon Sep 17 00:00:00 2001 From: Chris Caino Date: Tue, 3 Dec 2013 21:58:39 +0000 Subject: [PATCH] Broader condition for dangerous pawn moves Instead of a passed pawn now we just require the pawn to be in the opponent camp to be considered a dangerous move. Added some renaming to reflect the change. Passed both short TC test LLR: 2.95 (-2.94,2.94) [-1.50,4.50] Total: 10358 W: 2033 L: 1900 D: 6425 And long TC LLR: 2.95 (-2.94,2.94) [0.00,6.00] Total: 21459 W: 3486 L: 3286 D: 14687 bench: 8322172 --- src/bitboard.h | 2 ++ src/position.h | 8 +++----- src/search.cpp | 5 ++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/bitboard.h b/src/bitboard.h index 8154f574..ceac2c24 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -84,6 +84,8 @@ extern Bitboard PseudoAttacks[PIECE_TYPE_NB][SQUARE_NB]; extern int SquareDistance[SQUARE_NB][SQUARE_NB]; const Bitboard DarkSquares = 0xAA55AA55AA55AA55ULL; +const Bitboard TheirHalf[COLOR_NB] = { Rank5BB | Rank6BB | Rank7BB | Rank8BB, + Rank1BB | Rank2BB | Rank3BB | Rank4BB }; /// Overloads of bitwise operators between a Bitboard and a Square for testing /// whether a given bit is set in a bitboard, and for setting and clearing bits. diff --git a/src/position.h b/src/position.h index 907463d4..6defeb22 100644 --- a/src/position.h +++ b/src/position.h @@ -123,7 +123,7 @@ public: bool capture(Move m) const; bool capture_or_promotion(Move m) const; bool gives_check(Move m, const CheckInfo& ci) const; - bool passed_pawn_push(Move m) const; + bool advanced_pawn_push(Move m) const; Piece moved_piece(Move m) const; PieceType captured_piece_type() const; @@ -326,10 +326,8 @@ inline bool Position::pawn_passed(Color c, Square s) const { return !(pieces(~c, PAWN) & passed_pawn_mask(c, s)); } -inline bool Position::passed_pawn_push(Move m) const { - - return type_of(moved_piece(m)) == PAWN - && pawn_passed(sideToMove, to_sq(m)); +inline bool Position::advanced_pawn_push(Move m) const { + return pieces(PAWN) & TheirHalf[sideToMove] & from_sq(m); } inline Key Position::key() const { diff --git a/src/search.cpp b/src/search.cpp index 3d154889..23ce40f4 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -807,7 +807,7 @@ moves_loop: // When in check and at SpNode search starts from here captureOrPromotion = pos.capture_or_promotion(move); givesCheck = pos.gives_check(move, ci); dangerous = givesCheck - || pos.passed_pawn_push(move) + || pos.advanced_pawn_push(move) || type_of(move) == CASTLING; // Step 12. Extend checks @@ -1207,9 +1207,8 @@ moves_loop: // When in check and at SpNode search starts from here && !InCheck && !givesCheck && move != ttMove - && type_of(move) != PROMOTION && futilityBase > -VALUE_KNOWN_WIN - && !pos.passed_pawn_push(move)) + && !pos.advanced_pawn_push(move)) { futilityValue = futilityBase + PieceValue[EG][pos.piece_on(to_sq(move))] -- 2.39.2