]> git.sesse.net Git - stockfish/commitdiff
Good bishops on the main diagonals
authorStéphane Nicolet <cassio@free.fr>
Sun, 1 Oct 2017 22:41:06 +0000 (00:41 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 2 Oct 2017 05:53:28 +0000 (07:53 +0200)
Bonus in midgame for bishops on long diagonals when the central squares are not occupied by pawns.

Author: ElbertoOne

Passed STC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 10801 W: 1955 L: 1786 D: 7060
http://tests.stockfishchess.org/tests/view/59cf5c1d0ebc5916ff64b9da

and LTC:
LLR: 2.97 (-2.94,2.94) [0.00,5.00]
Total: 83978 W: 10685 L: 10303 D: 62990
http://tests.stockfishchess.org/tests/view/59cf6f6c0ebc5916ff64b9e4

Bench: 5620312

src/evaluate.cpp

index 031b803417c4c4832f7b6fe5bdb2a3d26618f724..f34c01b6c3e15cc8072e60d40c55c0f80626e964 100644 (file)
 
 namespace {
 
 
 namespace {
 
+  const Bitboard LongDiagonals = 0x8142241818244281ULL; // A1..H8 | H1..A8
+  const Bitboard Center        = (FileDBB | FileEBB) & (Rank4BB | Rank5BB);
+  const Bitboard QueenSide     = FileABB | FileBBB | FileCBB | FileDBB;
+  const Bitboard CenterFiles   = FileCBB | FileDBB | FileEBB | FileFBB;
+  const Bitboard KingSide      = FileEBB | FileFBB | FileGBB | FileHBB;
+
+  const Bitboard KingFlank[FILE_NB] = {
+    QueenSide, QueenSide, QueenSide, CenterFiles, CenterFiles, KingSide, KingSide, KingSide
+  };
+
   namespace Trace {
 
     enum Tracing {NO_TRACE, TRACE};
   namespace Trace {
 
     enum Tracing {NO_TRACE, TRACE};
@@ -204,6 +214,7 @@ namespace {
   // Assorted bonuses and penalties used by evaluation
   const Score MinorBehindPawn     = S( 16,  0);
   const Score BishopPawns         = S(  8, 12);
   // Assorted bonuses and penalties used by evaluation
   const Score MinorBehindPawn     = S( 16,  0);
   const Score BishopPawns         = S(  8, 12);
+  const Score LongRangedBishop    = S( 22,  0);
   const Score RookOnPawn          = S(  8, 24);
   const Score TrappedRook         = S( 92,  0);
   const Score WeakQueen           = S( 50, 10);
   const Score RookOnPawn          = S(  8, 24);
   const Score TrappedRook         = S( 92,  0);
   const Score WeakQueen           = S( 50, 10);
@@ -338,10 +349,18 @@ namespace {
                 && (pos.pieces(PAWN) & (s + pawn_push(Us))))
                 score += MinorBehindPawn;
 
                 && (pos.pieces(PAWN) & (s + pawn_push(Us))))
                 score += MinorBehindPawn;
 
-            // Penalty for pawns on the same color square as the bishop
             if (Pt == BISHOP)
             if (Pt == BISHOP)
+            {
+                // Penalty for pawns on the same color square as the bishop
                 score -= BishopPawns * pe->pawns_on_same_color_squares(Us, s);
 
                 score -= BishopPawns * pe->pawns_on_same_color_squares(Us, s);
 
+                // Bonus for bishop on a long diagonal without pawns in the center
+                if (    (LongDiagonals & s)
+                    && !(attackedBy[Them][PAWN] & s)
+                    && !(Center & PseudoAttacks[BISHOP][s] & pos.pieces(PAWN)))
+                    score += LongRangedBishop;
+            }
+
             // An important Chess960 pattern: A cornered bishop blocked by a friendly
             // pawn diagonally in front of it is a very serious problem, especially
             // when that pawn is also blocked.
             // An important Chess960 pattern: A cornered bishop blocked by a friendly
             // pawn diagonally in front of it is a very serious problem, especially
             // when that pawn is also blocked.
@@ -396,14 +415,6 @@ namespace {
 
   // evaluate_king() assigns bonuses and penalties to a king of a given color
 
 
   // evaluate_king() assigns bonuses and penalties to a king of a given color
 
-  const Bitboard QueenSide   = FileABB | FileBBB | FileCBB | FileDBB;
-  const Bitboard CenterFiles = FileCBB | FileDBB | FileEBB | FileFBB;
-  const Bitboard KingSide    = FileEBB | FileFBB | FileGBB | FileHBB;
-
-  const Bitboard KingFlank[FILE_NB] = {
-    QueenSide, QueenSide, QueenSide, CenterFiles, CenterFiles, KingSide, KingSide, KingSide
-  };
-
   template<Tracing T>  template<Color Us>
   Score Evaluation<T>::evaluate_king() {
 
   template<Tracing T>  template<Color Us>
   Score Evaluation<T>::evaluate_king() {