Simplify the "overload" condition
authorAlain SAVARD <support@multicim.com>
Fri, 20 Jul 2018 23:57:45 +0000 (19:57 -0400)
committerSt├ęphane Nicolet <cassio@free.fr>
Sat, 21 Jul 2018 05:05:50 +0000 (07:05 +0200)
This is a follow-up of the previous pull request (#1686) by Miguel.
We simplify the "Overload" bonus condition by re-using the "weak"
variable, which captures well the essence of the overload condition.
This may also be a small speed optimization because the weak variable
is in a register at this point of the code.

http://tests.stockfishchess.org/tests/view/5b527b440ebc5902bdb7f7db
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 10925 W: 2517 L: 2374 D: 6034

http://tests.stockfishchess.org/tests/view/5b527f930ebc5902bdb7f883
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 15569 W: 2697 L: 2568 D: 10304

Closes https://github.com/official-stockfish/Stockfish/pull/1687

Bench: 5010472

src/evaluate.cpp

index 5ceb9ae..95729e4 100644 (file)
@@ -557,10 +557,7 @@ namespace {
 
         score += Hanging * popcount(weak & ~attackedBy[Them][ALL_PIECES]);
 
-        // Bonus for overload (non-pawn enemies attacked once or more and defended exactly once)
-        b =  nonPawnEnemies
-           & attackedBy[Us][ALL_PIECES]
-           & attackedBy[Them][ALL_PIECES] & ~attackedBy2[Them];
+        b =  weak & nonPawnEnemies & attackedBy[Them][ALL_PIECES];
         score += Overload * popcount(b);
     }