From: Fabian Fichter Date: Sun, 20 Dec 2020 18:21:50 +0000 (+0100) Subject: Merge official-stockfish/master X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=df7a270e4bcb9728c875956991cccd0fbd95da18;p=fairystockfish.git Merge official-stockfish/master bench: 4173895 --- df7a270e4bcb9728c875956991cccd0fbd95da18 diff --cc src/evaluate.cpp index 1dc3b65,fd51ad5..2b61a68 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@@ -575,16 -484,28 +574,28 @@@ namespace if (Pt == ROOK) { - // Bonus for rook on an open or semi-open file + // Bonuses for rook on a (semi-)open or closed file if (pos.is_on_semiopen_file(Us, s)) - score += RookOnFile[pos.is_on_semiopen_file(Them, s)]; - - // Penalty when trapped by the king, even more if the king cannot castle - else if (mob <= 3 && pos.count(Us)) { - File kf = file_of(pos.square(Us)); - if ((kf < FILE_E) == (file_of(s) < kf)) - score -= TrappedRook * (1 + !pos.castling_rights(Us)); + score += RookOnOpenFile[pos.is_on_semiopen_file(Them, s)]; + } + else + { + // If our pawn on this file is blocked, increase penalty + if ( pos.pieces(Us, PAWN) + & shift(pos.pieces()) + & file_bb(s)) + { + score -= RookOnClosedFile; + } + + // Penalty when trapped by the king, even more if the king cannot castle - if (mob <= 3) ++ if (mob <= 3 && pos.count(Us)) + { + File kf = file_of(pos.square(Us)); + if ((kf < FILE_E) == (file_of(s) < kf)) + score -= TrappedRook * (1 + !pos.castling_rights(Us)); + } } }