From: Fabian Fichter Date: Sat, 15 Jun 2019 14:08:54 +0000 (+0200) Subject: Merge official-stockfish/master X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=a89bbe64e6115b3e40bdebb95bebf90a88ce8c06;p=fairystockfish.git Merge official-stockfish/master bench: 3785196 --- a89bbe64e6115b3e40bdebb95bebf90a88ce8c06 diff --cc src/evaluate.cpp index 1f6e7e8,30c22a8..5b5a5e6 --- a/src/evaluate.cpp +++ b/src/evaluate.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(Us)) { File kf = file_of(pos.square(Us)); if ((kf < FILE_E) == (file_of(s) < kf)) @@@ -1049,6 -805,11 +1045,11 @@@ 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(); diff --cc src/position.h index e5159d3,343751e..846a919 --- a/src/position.h +++ b/src/position.h @@@ -161,9 -95,8 +161,9 @@@ public template int count(Color c) const; template int count() const; template const Square* squares(Color c) const; + const Square* squares(Color c, PieceType pt) const; template 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 {