]> git.sesse.net Git - stockfish/commitdiff
Sync with master
authorMarco Costalba <mcostalba@gmail.com>
Sat, 28 Feb 2015 19:21:38 +0000 (20:21 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 28 Feb 2015 19:22:28 +0000 (20:22 +0100)
bench: 8285241

src/evaluate.cpp
src/pawns.cpp

index 25449771ed8388609737d23b4e511faed1d13fcf..30e4c59a040ea1761ebbfa9d6526f5e7f4ee94bc 100644 (file)
@@ -155,7 +155,7 @@ namespace {
   // ThreatenedByPawn[PieceType] contains a penalty according to which piece
   // type is attacked by an enemy pawn.
   const Score ThreatenedByPawn[PIECE_TYPE_NB] = {
-    S(0, 0), S(0, 0), S(87, 118), S(84, 122), S(114, 203), S(121, 217)
+    S(0, 0), S(0, 0), S(107, 138), S(84, 122), S(114, 203), S(121, 217)
   };
 
   // Assorted bonuses and penalties used by evaluation
index 1ae1b17fb1554d110b345c92633c7d6f87edf3b4..0b5c59d3fae0df6048f7852f872557af5274f16b 100644 (file)
@@ -110,9 +110,9 @@ namespace {
     const Square Right = (Us == WHITE ? DELTA_NE : DELTA_SW);
     const Square Left  = (Us == WHITE ? DELTA_NW : DELTA_SE);
 
-    Bitboard b, p, doubled, connected, supported;
+    Bitboard b, neighbours, doubled, connected, supported, phalanx;
     Square s;
-    bool passed, isolated, opposed, phalanx, backward, lever;
+    bool passed, isolated, opposed, backward, lever;
     Score score = SCORE_ZERO;
     const Square* pl = pos.list<PAWN>(Us);
     const Bitboard* pawnAttacksBB = StepAttacksBB[make_piece(Us, PAWN)];
@@ -137,18 +137,16 @@ namespace {
         // This file cannot be semi-open
         e->semiopenFiles[Us] &= ~(1 << f);
 
-        // Previous rank
-        p = rank_bb(s - Up);
-
         // Flag the pawn
-        connected   =   ourPawns   & adjacent_files_bb(f) & (rank_bb(s) | p);
-        phalanx     =   connected  & rank_bb(s);
-        supported   =   connected  & p;
-        isolated    = !(ourPawns   & adjacent_files_bb(f));
+        neighbours  =   ourPawns   & adjacent_files_bb(f);
         doubled     =   ourPawns   & forward_bb(Us, s);
         opposed     =   theirPawns & forward_bb(Us, s);
         passed      = !(theirPawns & passed_pawn_mask(Us, s));
         lever       =   theirPawns & pawnAttacksBB[s];
+        phalanx     =   neighbours & rank_bb(s);
+        supported   =   neighbours & rank_bb(s - Up);
+        connected   =   supported | phalanx;
+        isolated    =  !neighbours;
 
         // Test for backward pawn.
         // If the pawn is passed, isolated, lever or connected it cannot be
@@ -193,7 +191,7 @@ namespace {
             score -= Backward[opposed][f];
 
         if (connected)
-            score += Connected[opposed][phalanx][more_than_one(supported)][relative_rank(Us, s)];
+            score += Connected[opposed][!!phalanx][more_than_one(supported)][relative_rank(Us, s)];
 
         if (lever)
             score += Lever[relative_rank(Us, s)];