From abd4400c874ab178d04c08d3668f3843aece114e Mon Sep 17 00:00:00 2001 From: protonspring Date: Mon, 30 Sep 2019 15:10:44 -0600 Subject: [PATCH 1/1] Remove ThreatByRank This is a functional simplification that removes ThreatByRank. STC LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 48009 W: 10630 L: 10560 D: 26819 http://tests.stockfishchess.org/tests/view/5d92095c0ebc594fb88eb61e LTC LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 18682 W: 3177 L: 3053 D: 12452 http://tests.stockfishchess.org/tests/view/5d9231120ebc594fb88ebacd Moving forward, it's possible that ThreatByMinor and ThreatByRook could be combined, but I haven't really contemplated that yet. Closes https://github.com/official-stockfish/Stockfish/pull/2336 bench 4088701 --- src/evaluate.cpp | 17 +++-------------- src/search.cpp | 2 +- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 880aa137..fadc0fea 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -114,7 +114,7 @@ namespace { // which piece type attacks which one. Attacks on lesser pieces which are // pawn-defended are not considered. constexpr Score ThreatByMinor[PIECE_TYPE_NB] = { - S(0, 0), S(6, 28), S(39, 42), S(57, 44), S(68, 112), S(62, 120) + S(0, 0), S(6, 32), S(59, 41), S(79, 56), S(90, 119), S(79, 161) }; constexpr Score ThreatByRook[PIECE_TYPE_NB] = { @@ -143,7 +143,6 @@ namespace { constexpr Score SliderOnQueen = S( 59, 18); constexpr Score ThreatByKing = S( 24, 89); constexpr Score ThreatByPawnPush = S( 48, 39); - constexpr Score ThreatByRank = S( 13, 0); constexpr Score ThreatBySafePawn = S(173, 94); constexpr Score TrappedRook = S( 47, 4); constexpr Score WeakQueen = S( 49, 15); @@ -510,21 +509,11 @@ namespace { { b = (defended | weak) & (attackedBy[Us][KNIGHT] | attackedBy[Us][BISHOP]); while (b) - { - Square s = pop_lsb(&b); - score += ThreatByMinor[type_of(pos.piece_on(s))]; - if (type_of(pos.piece_on(s)) != PAWN) - score += ThreatByRank * (int)relative_rank(Them, s); - } + score += ThreatByMinor[type_of(pos.piece_on(pop_lsb(&b)))]; b = weak & attackedBy[Us][ROOK]; while (b) - { - Square s = pop_lsb(&b); - score += ThreatByRook[type_of(pos.piece_on(s))]; - if (type_of(pos.piece_on(s)) != PAWN) - score += ThreatByRank * (int)relative_rank(Them, s); - } + score += ThreatByRook[type_of(pos.piece_on(pop_lsb(&b)))]; if (weak & attackedBy[Us][KING]) score += ThreatByKing; diff --git a/src/search.cpp b/src/search.cpp index 2ad535cc..d34e1823 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1008,7 +1008,7 @@ moves_loop: // When in check, search starts from here && pos.advanced_pawn_push(move) && pos.pawn_passed(us, to_sq(move))) extension = ONE_PLY; - + // Castling extension if (type_of(move) == CASTLING) extension = ONE_PLY; -- 2.39.2