]> git.sesse.net Git - stockfish/blobdiff - src/position.cpp
Simplify away SEE verification
[stockfish] / src / position.cpp
index 171193ec1315af1173e176496b06a74ba1a26234..af274d3f2c64183e61eaa163a121112082b8ede1 100644 (file)
@@ -331,8 +331,7 @@ void Position::set_check_info() const {
 
 /// Position::set_state() computes the hash keys of the position, and other
 /// data that once computed is updated incrementally as moves are made.
-/// The function is only used when a new position is set up, and to verify
-/// the correctness of the StateInfo data when running in debug mode.
+/// The function is only used when a new position is set up
 
 void Position::set_state() const {
 
@@ -1081,7 +1080,7 @@ bool Position::see_ge(Move m, Value threshold) const {
       return true;
 
   assert(color_of(piece_on(from)) == sideToMove);
-  Bitboard occupied = pieces() ^ from ^ to;
+  Bitboard occupied = pieces() ^ from ^ to; // xoring to is important for pinned piece logic
   Color stm = sideToMove;
   Bitboard attackers = attackers_to(to, occupied);
   Bitboard stmAttackers, bb;
@@ -1114,8 +1113,8 @@ bool Position::see_ge(Move m, Value threshold) const {
       {
           if ((swap = PawnValueMg - swap) < res)
               break;
-
           occupied ^= least_significant_square_bb(bb);
+
           attackers |= attacks_bb<BISHOP>(to, occupied) & pieces(BISHOP, QUEEN);
       }
 
@@ -1123,7 +1122,6 @@ bool Position::see_ge(Move m, Value threshold) const {
       {
           if ((swap = KnightValueMg - swap) < res)
               break;
-
           occupied ^= least_significant_square_bb(bb);
       }
 
@@ -1131,8 +1129,8 @@ bool Position::see_ge(Move m, Value threshold) const {
       {
           if ((swap = BishopValueMg - swap) < res)
               break;
-
           occupied ^= least_significant_square_bb(bb);
+
           attackers |= attacks_bb<BISHOP>(to, occupied) & pieces(BISHOP, QUEEN);
       }
 
@@ -1140,8 +1138,8 @@ bool Position::see_ge(Move m, Value threshold) const {
       {
           if ((swap = RookValueMg - swap) < res)
               break;
-
           occupied ^= least_significant_square_bb(bb);
+
           attackers |= attacks_bb<ROOK>(to, occupied) & pieces(ROOK, QUEEN);
       }
 
@@ -1149,8 +1147,8 @@ bool Position::see_ge(Move m, Value threshold) const {
       {
           if ((swap = QueenValueMg - swap) < res)
               break;
-
           occupied ^= least_significant_square_bb(bb);
+
           attackers |=  (attacks_bb<BISHOP>(to, occupied) & pieces(BISHOP, QUEEN))
                       | (attacks_bb<ROOK  >(to, occupied) & pieces(ROOK  , QUEEN));
       }