Merge official-stockfish/master
authorFabian Fichter <ianfab@users.noreply.github.com>
Sun, 20 Sep 2020 12:10:42 +0000 (14:10 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sun, 20 Sep 2020 12:10:42 +0000 (14:10 +0200)
bench: 4262221

1  2 
src/endgame.cpp
src/evaluate.cpp
src/search.cpp

diff --cc src/endgame.cpp
Simple merge
@@@ -1157,7 -793,7 +1171,8 @@@ namespace 
                  && pos.non_pawn_material(BLACK) == RookValueMg
                  && pos.count<PAWN>(strongSide) - pos.count<PAWN>(~strongSide) <= 1
                  && bool(KingSide & pos.pieces(strongSide, PAWN)) != bool(QueenSide & pos.pieces(strongSide, PAWN))
-                 && (attackedBy[~strongSide][KING] & pos.pieces(~strongSide, PAWN)))
++                && pos.count<KING>(~strongSide)
+                 && (attacks_bb<KING>(pos.square<KING>(~strongSide)) & pos.pieces(~strongSide, PAWN)))
              sf = 36;
          else if (pos.count<QUEEN>() == 1)
              sf = 37 + 3 * (pos.count<QUEEN>(WHITE) == 1 ? pos.count<BISHOP>(BLACK) + pos.count<KNIGHT>(BLACK)
      score += pe->pawn_score(WHITE) - pe->pawn_score(BLACK);
  
      // Early exit if score is high
-     Value v = (mg_value(score) + eg_value(score)) / 2;
-     if (abs(v) > LazyThreshold + pos.non_pawn_material() / 64 && Options["UCI_Variant"] == "chess")
-        return pos.side_to_move() == WHITE ? v : -v;
+     auto lazy_skip = [&](Value lazyThreshold) {
+         return abs(mg_value(score) + eg_value(score)) / 2 > lazyThreshold + pos.non_pawn_material() / 64;
+     };
 -    if (lazy_skip(LazyThreshold1))
++    if (lazy_skip(LazyThreshold1) && Options["UCI_Variant"] == "chess")
+         goto make_v;
  
      // Main evaluation begins here
      initialize<WHITE>();
  
      // More complex interactions that require fully populated attack bitboards
      score +=  king<   WHITE>() - king<   BLACK>()
-             + threats<WHITE>() - threats<BLACK>()
 -            + passed< WHITE>() - passed< BLACK>();
 +            + passed< WHITE>() - passed< BLACK>()
-             + space<  WHITE>() - space<  BLACK>()
 +            + variant<WHITE>() - variant<BLACK>();
  
 -    if (lazy_skip(LazyThreshold2))
++    if (lazy_skip(LazyThreshold2) && Options["UCI_Variant"] == "chess")
+         goto make_v;
+     score +=  threats<WHITE>() - threats<BLACK>()
+             + space<  WHITE>() - space<  BLACK>();
+ make_v:
      // Derive single value from mg and eg parts of score
-     v = winnable(score);
+     Value v = winnable(score);
  
      // In case of tracing add all remaining individual evaluation terms
      if (T)
diff --cc src/search.cpp
@@@ -945,6 -871,8 +945,8 @@@ namespace 
          }
      }
  
 -    probcutBeta = beta + 176 - 49 * improving;
++    probcutBeta = beta + (176 + 20 * !!pos.capture_the_flag_piece()) * (1 + pos.check_counting() + (pos.extinction_value() != VALUE_NONE)) - 49 * improving;
      // Step 10. ProbCut (~10 Elo)
      // If we have a good enough capture and a reduced search returns a value
      // much above beta, we can (almost) safely prune the previous move.
@@@ -1191,18 -1131,6 +1209,12 @@@ moves_loop: // When in check, search st
        if (type_of(move) == CASTLING)
            extension = 1;
  
-       // Late irreversible move extension
-       if (   move == ttMove
-           && pos.rule50_count() > 80
-           && (captureOrPromotion || type_of(movedPiece) == PAWN))
-           extension = 2;
 +      // Losing chess capture extension
 +      else if (    pos.must_capture()
 +               &&  pos.capture(move)
 +               &&  MoveList<CAPTURES>(pos).size() == 1)
 +          extension = 1;
 +
        // Add extension to new depth
        newDepth += extension;