]> git.sesse.net Git - stockfish/commitdiff
Remove conditional_more_than_two().
authorprotonspring <mike@whiteley.org>
Sat, 25 Jul 2020 13:32:19 +0000 (07:32 -0600)
committerStéphane Nicolet <Stephane.Nicolet@u-paris2.fr>
Fri, 31 Jul 2020 07:47:24 +0000 (09:47 +0200)
This is a functional simplification that removes the conditional_more_than_two()
function, which was quite strange and kooky. Note the very minor change to the bench
value.

See this thread for relevant comments on the passing branch:
protonspring/Stockfish@d89730d...ff35b50

STC
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 59760 W: 11411 L: 11311 D: 37038
Ptnml(0-2): 992, 6863, 14044, 7015, 966
https://tests.stockfishchess.org/tests/view/5f179988c09435d870cb9b9a

LTC
LLR: 2.93 (-2.94,2.94) {-1.50,0.50}
Total: 45208 W: 5553 L: 5497 D: 34158
Ptnml(0-2): 315, 4081, 13761, 4127, 320
https://tests.stockfishchess.org/tests/view/5f184847c09435d870cb9bee

closes https://github.com/official-stockfish/Stockfish/pull/2826

Bench: 4578290

src/bitboard.h
src/evaluate.cpp

index 15ec4153362d82d1339e9657e19190cf2e118005..8c95de8c66c3b7a359a04dcb83fce04cd9cce52e 100644 (file)
@@ -130,12 +130,6 @@ constexpr bool more_than_one(Bitboard b) {
   return b & (b - 1);
 }
 
-/// Counts the occupation of the bitboard depending on the occupation of SQ_A1
-/// as in `b & (1ULL << SQ_A1) ? more_than_two(b) : more_than_one(b)`
-
-constexpr bool conditional_more_than_two(Bitboard b) {
-  return b & (b - 1) & (b - 2);
-}
 
 constexpr bool opposite_colors(Square s1, Square s2) {
   return (s1 + rank_of(s1) + s2 + rank_of(s2)) & 1;
index dbb725d4dbf558639b2ce9daf80532d992681e74..d16648a84ea3458394fee142779c7d0e7d56c602 100644 (file)
@@ -310,13 +310,15 @@ namespace {
 
         if (Pt == BISHOP || Pt == KNIGHT)
         {
-            // Bonus if piece is on an outpost square or can reach one
+            // Bonus if the piece is on an outpost square or can reach one
+            // Reduced bonus for knights (BadOutpost) if few relevant targets
             bb = OutpostRanks & attackedBy[Us][PAWN] & ~pe->pawn_attacks_span(Them);
+            Bitboard targets = pos.pieces(Them) & ~pos.pieces(PAWN);
+
             if (   Pt == KNIGHT
-                && bb & s & ~CenterFiles
-                && !(b & pos.pieces(Them) & ~pos.pieces(PAWN))
-                && !conditional_more_than_two(
-                      pos.pieces(Them) & ~pos.pieces(PAWN) & (s & QueenSide ? QueenSide : KingSide)))
+                && bb & s & ~CenterFiles // on a side outpost
+                && !(b & targets)        // no relevant attacks
+                && (!more_than_one(targets & (s & QueenSide ? QueenSide : KingSide))))
                 score += BadOutpost;
             else if (bb & s)
                 score += Outpost[Pt == BISHOP];