]> git.sesse.net Git - stockfish/commitdiff
Simplify Safe Checks
authormstembera <MissingEmail@email>
Tue, 15 Mar 2016 03:49:25 +0000 (20:49 -0700)
committerJoona Kiiski <joona@zoox.com>
Tue, 15 Mar 2016 03:51:16 +0000 (20:51 -0700)
STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 11796 W: 2211 L: 2074 D: 7511

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 14324 W: 1935 L: 1806 D: 10583

Bench: 8075202

Resolves #600

src/evaluate.cpp

index d040143272c43ea6ee31d8f205306574b9f24cd8..b380dbf074874717e93d5adfcfc6f3d80f54f2b3 100644 (file)
@@ -424,36 +424,20 @@ namespace {
         b2 = pos.attacks_from<BISHOP>(ksq) & safe;
 
         // Enemy queen safe checks
-        b = (b1 | b2) & ei.attackedBy[Them][QUEEN];
-        if (b)
-        {
-            attackUnits += QueenCheck * popcount<Max15>(b);
-            score -= Checked;
-        }
+        if ((b1 | b2) & ei.attackedBy[Them][QUEEN])
+            attackUnits += QueenCheck, score -= Checked;
 
         // Enemy rooks safe checks
-        b = b1 & ei.attackedBy[Them][ROOK];
-        if (b)
-        {
-            attackUnits += RookCheck * popcount<Max15>(b);
-            score -= Checked;
-        }
+        if (b1 & ei.attackedBy[Them][ROOK])
+            attackUnits += RookCheck, score -= Checked;
 
         // Enemy bishops safe checks
-        b = b2 & ei.attackedBy[Them][BISHOP];
-        if (b)
-        {
-            attackUnits += BishopCheck * popcount<Max15>(b);
-            score -= Checked;
-        }
+        if (b2 & ei.attackedBy[Them][BISHOP])
+            attackUnits += BishopCheck, score -= Checked;
 
         // Enemy knights safe checks
-        b = pos.attacks_from<KNIGHT>(ksq) & ei.attackedBy[Them][KNIGHT] & safe;
-        if (b)
-        {
-            attackUnits += KnightCheck * popcount<Max15>(b);
-            score -= Checked;
-        }
+        if (pos.attacks_from<KNIGHT>(ksq) & ei.attackedBy[Them][KNIGHT] & safe)
+            attackUnits += KnightCheck, score -= Checked;
 
         // Finally, extract the king danger score from the KingDanger[]
         // array and subtract the score from the evaluation.