]> git.sesse.net Git - stockfish/commitdiff
Broader condition for dangerous pawn moves
authorChris Caino <chricainogithub@gmail.com>
Tue, 3 Dec 2013 21:58:39 +0000 (21:58 +0000)
committerMarco Costalba <mcostalba@gmail.com>
Wed, 4 Dec 2013 16:19:45 +0000 (17:19 +0100)
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
src/position.h
src/search.cpp

index 8154f574c6d7baedde7ccea8d50e94005db7fdfb..ceac2c24ed5b05f86866e14511347aa8a0ed7caf 100644 (file)
@@ -84,6 +84,8 @@ extern Bitboard PseudoAttacks[PIECE_TYPE_NB][SQUARE_NB];
 extern int SquareDistance[SQUARE_NB][SQUARE_NB];
 
 const Bitboard DarkSquares = 0xAA55AA55AA55AA55ULL;
 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.
 
 /// 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.
index 907463d47d4ea2db4a7bfdc91268d4108c884ef8..6defeb22bd9cedc8fbab20b6a50c28773974bc0e 100644 (file)
@@ -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 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;
 
   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));
 }
 
   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 {
 }
 
 inline Key Position::key() const {
index 3d154889514c25529e61ea14800266c0198a931f..23ce40f489859f36f52481cc92bc0c0466b373d1 100644 (file)
@@ -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
       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
                  || 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
           && !InCheck
           && !givesCheck
           &&  move != ttMove
-          &&  type_of(move) != PROMOTION
           &&  futilityBase > -VALUE_KNOWN_WIN
           &&  futilityBase > -VALUE_KNOWN_WIN
-          && !pos.passed_pawn_push(move))
+          && !pos.advanced_pawn_push(move))
       {
           futilityValue =  futilityBase
                          + PieceValue[EG][pos.piece_on(to_sq(move))]
       {
           futilityValue =  futilityBase
                          + PieceValue[EG][pos.piece_on(to_sq(move))]