]> git.sesse.net Git - stockfish/blobdiff - src/evaluate.cpp
Rename getters functions removing 'get_' prefix
[stockfish] / src / evaluate.cpp
index 558f05b06ee4292bca48c5af3fc7d834866af315..5d8d7b9902ec77fa1e1078e26b7e44725d44da7a 100644 (file)
@@ -89,7 +89,7 @@ namespace {
   //
   // Values modified by Joona Kiiski
   const Score WeightsInternal[] = {
-      S(252, 344), S(252, 259), S(46, 0), S(247, 0), S(259, 0)
+      S(252, 344), S(216, 266), S(46, 0), S(247, 0), S(259, 0)
   };
 
   // MobilityBonus[PieceType][attacked] contains mobility bonuses for middle and
@@ -288,7 +288,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
   margins[WHITE] = margins[BLACK] = VALUE_ZERO;
 
   // Probe the material hash table
-  ei.mi = Threads[pos.thread()].materialTable.get_material_info(pos);
+  ei.mi = Threads[pos.thread()].materialTable.material_info(pos);
   score += ei.mi->material_value();
 
   // If we have a specialized evaluation function for the current material
@@ -300,7 +300,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
   }
 
   // Probe the pawn hash table
-  ei.pi = Threads[pos.thread()].pawnTable.get_pawn_info(pos);
+  ei.pi = Threads[pos.thread()].pawnTable.pawn_info(pos);
   score += ei.pi->pawns_value();
 
   // Initialize attack and king safety bitboards
@@ -462,8 +462,8 @@ namespace {
     // no minor piece which can exchange the outpost piece.
     if (bonus && bit_is_set(ei.attackedBy[Us][PAWN], s))
     {
-        if (    pos.pieces(KNIGHT, Them) == EmptyBoardBB
-            && (SquaresByColorBB[color_of(s)] & pos.pieces(BISHOP, Them)) == EmptyBoardBB)
+        if (   !pos.pieces(KNIGHT, Them)
+            && !(SquaresByColorBB[color_of(s)] & pos.pieces(BISHOP, Them)))
             bonus += bonus + bonus / 2;
         else
             bonus += bonus / 2;
@@ -488,7 +488,7 @@ namespace {
     const Color Them = (Us == WHITE ? BLACK : WHITE);
     const Square* pl = pos.piece_list(Us, Piece);
 
-    ei.attackedBy[Us][Piece] = EmptyBoardBB;
+    ei.attackedBy[Us][Piece] = 0;
 
     while ((s = *pl++) != SQ_NONE)
     {
@@ -813,8 +813,8 @@ namespace {
             Square blockSq = s + pawn_push(Us);
 
             // Adjust bonus based on kings proximity
-            ebonus += Value(square_distance(pos.king_square(Them), blockSq) * 6 * rr);
-            ebonus -= Value(square_distance(pos.king_square(Us), blockSq) * 3 * rr);
+            ebonus += Value(square_distance(pos.king_square(Them), blockSq) * 5 * rr);
+            ebonus -= Value(square_distance(pos.king_square(Us), blockSq) * 2 * rr);
 
             // If blockSq is not the queening square then consider also a second push
             if (rank_of(blockSq) != (Us == WHITE ? RANK_8 : RANK_1))
@@ -845,19 +845,15 @@ namespace {
                     // If yes, big bonus (but smaller than when there are no enemy attacks),
                     // if no, somewhat smaller bonus.
                     ebonus += Value(rr * ((unsafeSquares & defendedSquares) == unsafeSquares ? 13 : 8));
-
-                // At last, add a small bonus when there are no *friendly* pieces
-                // in the pawn's path.
-                if (!(squaresToQueen & pos.pieces(Us)))
-                    ebonus += Value(rr);
             }
         } // rr != 0
 
         // Increase the bonus if the passed pawn is supported by a friendly pawn
         // on the same rank and a bit smaller if it's on the previous rank.
-        supportingPawns = pos.pieces(PAWN, Us) & neighboring_files_bb(s);
+        supportingPawns = pos.pieces(PAWN, Us) & neighboring_files_bb(file_of(s));
         if (supportingPawns & rank_bb(s))
             ebonus += Value(r * 20);
+
         else if (supportingPawns & rank_bb(s - pawn_push(Us)))
             ebonus += Value(r * 12);
 
@@ -983,7 +979,7 @@ namespace {
         pliesToGo = 2 * movesToGo - int(loserSide == pos.side_to_move());
 
         // Generate list of blocking pawns and supporters
-        supporters = neighboring_files_bb(s) & candidates;
+        supporters = neighboring_files_bb(file_of(s)) & candidates;
         opposed = squares_in_front_of(loserSide, s) & pos.pieces(PAWN, winnerSide);
         blockers = passed_pawn_mask(loserSide, s) & pos.pieces(PAWN, winnerSide);