Merge official-stockfish/master
authorFabian Fichter <ianfab@users.noreply.github.com>
Sat, 15 Jun 2019 14:08:54 +0000 (16:08 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sat, 15 Jun 2019 14:08:54 +0000 (16:08 +0200)
bench: 3785196

1  2 
src/evaluate.cpp
src/position.cpp
src/position.h
src/search.cpp

@@@ -29,6 -29,6 +29,7 @@@
  #include "material.h"
  #include "pawns.h"
  #include "thread.h"
++#include "uci.h"
  
  namespace Trace {
  
@@@ -396,15 -351,15 +396,15 @@@ namespace 
          if (Pt == ROOK)
          {
              // Bonus for aligning rook with enemy pawns on the same rank/file
 -            if (relative_rank(Us, s) >= RANK_5)
 -                score += RookOnPawn * popcount(pos.pieces(Them, PAWN) & PseudoAttacks[ROOK][s]);
 +            if (relative_rank(Us, s, pos.max_rank()) >= RANK_5)
 +                score += RookOnPawn * popcount(pos.pieces(Them, PAWN) & PseudoAttacks[Us][ROOK][s]);
  
              // Bonus for rook on an open or semi-open file
-             if (pos.is_semiopen_file(Us, file_of(s)))
-                 score += RookOnFile[bool(pos.is_semiopen_file(Them, file_of(s)))];
+             if (pos.is_on_semiopen_file(Us, s))
+                 score += RookOnFile[bool(pos.is_on_semiopen_file(Them, s))];
  
              // Penalty when trapped by the king, even more if the king cannot castle
 -            else if (mob <= 3)
 +            else if (mob <= 3 && pos.count<KING>(Us))
              {
                  File kf = file_of(pos.square<KING>(Us));
                  if ((kf < FILE_E) == (file_of(s) < kf))
      pe = Pawns::probe(pos);
      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))
++    if (abs(v) > (LazyThreshold + pos.non_pawn_material() / 64) && Options["UCI_Variant"] == "chess")
+        return pos.side_to_move() == WHITE ? v : -v;
      // Main evaluation begins here
  
      initialize<WHITE>();
Simple merge
diff --cc src/position.h
@@@ -161,9 -95,8 +161,9 @@@ public
    template<PieceType Pt> int count(Color c) const;
    template<PieceType Pt> int count() const;
    template<PieceType Pt> const Square* squares(Color c) const;
 +  const Square* squares(Color c, PieceType pt) const;
    template<PieceType Pt> Square square(Color c) const;
-   bool is_semiopen_file(Color c, File f) const;
+   bool is_on_semiopen_file(Color c, Square s) const;
  
    // Castling
    int castling_rights(Color c) const;
@@@ -671,8 -263,8 +671,8 @@@ inline Square Position::ep_square() con
    return st->epSquare;
  }
  
- inline bool Position::is_semiopen_file(Color c, File f) const {
-   return !(pieces(c, PAWN, SHOGI_PAWN) & file_bb(f));
+ inline bool Position::is_on_semiopen_file(Color c, Square s) const {
 -  return !(pieces(c, PAWN) & file_bb(s));
++  return !(pieces(c, PAWN, SHOGI_PAWN) & file_bb(s));
  }
  
  inline bool Position::can_castle(CastlingRight cr) const {
diff --cc src/search.cpp
Simple merge