]> git.sesse.net Git - stockfish/commitdiff
Retire PieceValueXXX[] getters
authorMarco Costalba <mcostalba@gmail.com>
Sat, 22 Oct 2011 14:52:53 +0000 (15:52 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 22 Oct 2011 15:06:59 +0000 (16:06 +0100)
They don't add any value given that the corresponding
table has global visibility anyhow.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/movepick.cpp
src/position.cpp
src/position.h
src/search.cpp
src/types.h

index 88b4fe9c6ab9bf320832e34642b7f657de95f186..2b20f25f002447861a6deeddbf6260af21114c2b 100644 (file)
@@ -138,7 +138,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, const History& h, PieceType
   assert (!pos.in_check());
 
   // In ProbCut we consider only captures better than parent's move
-  captureThreshold = piece_value_midgame(Piece(parentCapture));
+  captureThreshold = PieceValueMidgame[Piece(parentCapture)];
   phasePtr = ProbCutTable;
 
   if (   ttm != MOVE_NONE
@@ -251,11 +251,11 @@ void MovePicker::score_captures() {
   for (MoveStack* cur = moves; cur != lastMove; cur++)
   {
       m = cur->move;
-      cur->score =  piece_value_midgame(pos.piece_on(move_to(m)))
+      cur->score =  PieceValueMidgame[pos.piece_on(move_to(m))]
                   - type_of(pos.piece_on(move_from(m)));
 
       if (is_promotion(m))
-          cur->score += piece_value_midgame(Piece(promotion_piece_type(m)));
+          cur->score += PieceValueMidgame[Piece(promotion_piece_type(m))];
   }
 }
 
@@ -290,7 +290,7 @@ void MovePicker::score_evasions() {
       if ((seeScore = pos.see_sign(m)) < 0)
           cur->score = seeScore - History::MaxValue; // Be sure we are at the bottom
       else if (pos.is_capture(m))
-          cur->score =  piece_value_midgame(pos.piece_on(move_to(m)))
+          cur->score =  PieceValueMidgame[pos.piece_on(move_to(m))]
                       - type_of(pos.piece_on(move_from(m))) + History::MaxValue;
       else
           cur->score = H.value(pos.piece_on(move_from(m)), move_to(m));
index 0a04b99b1ac9d1be07bd11ae0430848a7344449c..9d7679ab0979e1daee7f38528d6b5bdb23d318e9 100644 (file)
@@ -1351,7 +1351,7 @@ int Position::see_sign(Move m) const {
   // Early return if SEE cannot be negative because captured piece value
   // is not less then capturing one. Note that king moves always return
   // here because king midgame value is set to 0.
-  if (piece_value_midgame(piece_on(to)) >= piece_value_midgame(piece_on(from)))
+  if (PieceValueMidgame[piece_on(to)] >= PieceValueMidgame[piece_on(from)])
       return 1;
 
   return see(m);
@@ -1558,7 +1558,7 @@ Key Position::compute_material_key() const {
 
   for (Color c = WHITE; c <= BLACK; c++)
       for (PieceType pt = PAWN; pt <= QUEEN; pt++)
-          for (int i = 0, cnt = piece_count(c, pt); i < cnt; i++)
+          for (int i = 0; i < piece_count(c, pt); i++)
               result ^= zobrist[c][pt][i];
 
   return result;
@@ -1682,7 +1682,7 @@ void Position::init() {
 
   for (Piece p = WP; p <= WK; p++)
   {
-      Score ps = make_score(piece_value_midgame(p), piece_value_endgame(p));
+      Score ps = make_score(PieceValueMidgame[p], PieceValueEndgame[p]);
 
       for (Square s = SQ_A1; s <= SQ_H8; s++)
       {
index fd2222b4ec9360cf3c04e882d3324aa2ea23b444..5d14f0642195febc82309eff7234f5a3c2811425 100644 (file)
@@ -263,7 +263,7 @@ private:
 
   // Static variables
   static Score pieceSquareTable[16][64]; // [piece][square]
-  static Key zobrist[2][8][64];          // [color][pieceType][square]
+  static Key zobrist[2][8][64];          // [color][pieceType][square]/[piece count]
   static Key zobEp[64];                  // [square]
   static Key zobCastle[16];              // [castleRight]
   static Key zobSideToMove;
index 438a01be6c8ed7defbf765430f0404c3a0f37ca1..da95877cf793f232a7b2f6c600fbb8895b612189 100644 (file)
@@ -284,7 +284,7 @@ namespace {
     if (   captureOrPromotion
         && type_of(pos.piece_on(move_to(m))) != PAWN
         && (  pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK)
-            - piece_value_midgame(pos.piece_on(move_to(m))) == VALUE_ZERO)
+            - PieceValueMidgame[pos.piece_on(move_to(m))] == VALUE_ZERO)
         && !is_special(m))
     {
         result += PawnEndgameExtension[PvNode];
@@ -1399,7 +1399,7 @@ split_point_start: // At split points actual search starts from here
           && !pos.is_passed_pawn_push(move))
       {
           futilityValue =  futilityBase
-                         + piece_value_endgame(pos.piece_on(move_to(move)))
+                         + PieceValueEndgame[pos.piece_on(move_to(move))]
                          + (is_enpassant(move) ? PawnValueEndgame : VALUE_ZERO);
 
           if (futilityValue < beta)
@@ -1532,7 +1532,7 @@ split_point_start: // At split points actual search starts from here
     while (b)
     {
         victimSq = pop_1st_bit(&b);
-        futilityValue = futilityBase + piece_value_endgame(pos.piece_on(victimSq));
+        futilityValue = futilityBase + PieceValueEndgame[pos.piece_on(victimSq)];
 
         // Note that here we generate illegal "double move"!
         if (   futilityValue >= beta
@@ -1656,7 +1656,7 @@ split_point_start: // At split points actual search starts from here
     // Case 2: If the threatened piece has value less than or equal to the
     // value of the threatening piece, don't prune moves which defend it.
     if (   pos.is_capture(threat)
-        && (   piece_value_midgame(pos.piece_on(tfrom)) >= piece_value_midgame(pos.piece_on(tto))
+        && (   PieceValueMidgame[pos.piece_on(tfrom)] >= PieceValueMidgame[pos.piece_on(tto)]
             || type_of(pos.piece_on(tfrom)) == KING)
         && pos.move_attacks_square(m, tto))
         return true;
index 8facaafa7489b0a0b4e1a0e1fe42dbab3c13b5bb..9ac0787e1c08b045c6f45b48c3f15c43395e8a7a 100644 (file)
@@ -350,14 +350,6 @@ extern const Value PieceValueMidgame[17];
 extern const Value PieceValueEndgame[17];
 extern int SquareDistance[64][64];
 
-inline Value piece_value_midgame(Piece p) {
-  return PieceValueMidgame[p];
-}
-
-inline Value piece_value_endgame(Piece p) {
-  return PieceValueEndgame[p];
-}
-
 inline Value value_mate_in(int ply) {
   return VALUE_MATE - ply;
 }