]> git.sesse.net Git - stockfish/commitdiff
Rename OutpostMask[] in AttackSpanMask[]
authorMarco Costalba <mcostalba@gmail.com>
Fri, 14 May 2010 13:11:32 +0000 (15:11 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 14 May 2010 15:55:35 +0000 (16:55 +0100)
This is a more standard naming (see chessprogramming wiki)
and is more stick to what table is and not what is used for.

Code in pawns.cpp is a bit more readable now, at least for me ;-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/bitboard.cpp
src/bitboard.h
src/pawns.cpp
src/position.h

index cae7e0cae32e2fedf633af09730b631661517252..f014fe1939b6d4da4b13c5eafe1d286b8ae3312a 100644 (file)
@@ -228,7 +228,7 @@ Bitboard BetweenBB[64][64];
 
 Bitboard SquaresInFrontMask[2][64];
 Bitboard PassedPawnMask[2][64];
 
 Bitboard SquaresInFrontMask[2][64];
 Bitboard PassedPawnMask[2][64];
-Bitboard OutpostMask[2][64];
+Bitboard AttackSpanMask[2][64];
 
 Bitboard BishopPseudoAttacks[64];
 Bitboard RookPseudoAttacks[64];
 
 Bitboard BishopPseudoAttacks[64];
 Bitboard RookPseudoAttacks[64];
@@ -430,7 +430,7 @@ namespace {
         {
             SquaresInFrontMask[c][s] = in_front_bb(c, s) & file_bb(s);
             PassedPawnMask[c][s] = in_front_bb(c, s) & this_and_neighboring_files_bb(s);
         {
             SquaresInFrontMask[c][s] = in_front_bb(c, s) & file_bb(s);
             PassedPawnMask[c][s] = in_front_bb(c, s) & this_and_neighboring_files_bb(s);
-            OutpostMask[c][s] = in_front_bb(c, s) & neighboring_files_bb(s);
+            AttackSpanMask[c][s] = in_front_bb(c, s) & neighboring_files_bb(s);
         }
 
     for (Bitboard b = 0ULL; b < 256ULL; b++)
         }
 
     for (Bitboard b = 0ULL; b < 256ULL; b++)
index f27340d9a0c5764a97c3c67ae7b443c53b4d307d..1ad5fdcb305b8a09ce2ac9cb37020c1d3a5dd784 100644 (file)
@@ -76,7 +76,7 @@ extern Bitboard BetweenBB[64][64];
 
 extern Bitboard SquaresInFrontMask[2][64];
 extern Bitboard PassedPawnMask[2][64];
 
 extern Bitboard SquaresInFrontMask[2][64];
 extern Bitboard PassedPawnMask[2][64];
-extern Bitboard OutpostMask[2][64];
+extern Bitboard AttackSpanMask[2][64];
 
 extern const uint64_t RMult[64];
 extern const int RShift[64];
 
 extern const uint64_t RMult[64];
 extern const int RShift[64];
@@ -128,9 +128,8 @@ inline void do_move_bb(Bitboard *b, Bitboard move_bb) {
   *b ^= move_bb;
 }
 
   *b ^= move_bb;
 }
 
-/// rank_bb() and file_bb() gives a bitboard containing all squares on a given
-/// file or rank.  It is also possible to pass a square as input to these
-/// functions.
+/// rank_bb() and file_bb() take a file or a square as input, and return
+/// a bitboard representing all squares on the given file or rank.
 
 inline Bitboard rank_bb(Rank r) {
   return RankBB[r];
 
 inline Bitboard rank_bb(Rank r) {
   return RankBB[r];
@@ -301,13 +300,13 @@ inline Bitboard passed_pawn_mask(Color c, Square s) {
 }
 
 
 }
 
 
-/// outpost_mask takes a color and a square as input, and returns a bitboard
-/// mask which can be used to test whether a piece on the square can possibly
-/// be driven away by an enemy pawn. Definition of the table is:
-/// OutpostMask[c][s] = in_front_bb(c, s) & neighboring_files_bb(s);
+/// attack_span_mask takes a color and a square as input, and returns a bitboard
+/// representing all squares that can be attacked by a pawn of the given color
+/// when it moves along its file starting from the given square. Definition is:
+/// AttackSpanMask[c][s] = in_front_bb(c, s) & neighboring_files_bb(s);
 
 
-inline Bitboard outpost_mask(Color c, Square s) {
-  return OutpostMask[c][s];
+inline Bitboard attack_span_mask(Color c, Square s) {
+  return AttackSpanMask[c][s];
 }
 
 
 }
 
 
index c2d60e4b4b3b30b65b29f79d4c02e5711642b4db..9ca1f67f536d8291125ab6852b8e438086352f3e 100644 (file)
@@ -231,7 +231,7 @@ Score PawnInfoTable::evaluate_pawns(const Position& pos, Bitboard ourPawns,
       // there are friendly pawns behind on neighboring files it cannot
       // be backward either.
       if (   (passed | isolated | chain)
       // there are friendly pawns behind on neighboring files it cannot
       // be backward either.
       if (   (passed | isolated | chain)
-          || (ourPawns & outpost_mask(opposite_color(Us), s))
+          || (ourPawns & attack_span_mask(opposite_color(Us), s))
           || (pos.attacks_from<PAWN>(s, Us) & theirPawns))
           backward = false;
       else
           || (pos.attacks_from<PAWN>(s, Us) & theirPawns))
           backward = false;
       else
@@ -252,12 +252,12 @@ Score PawnInfoTable::evaluate_pawns(const Position& pos, Bitboard ourPawns,
           backward = (b | (Us == WHITE ? b << 8 : b >> 8)) & theirPawns;
       }
 
           backward = (b | (Us == WHITE ? b << 8 : b >> 8)) & theirPawns;
       }
 
-      assert(passed | opposed | (outpost_mask(Us, s) & theirPawns));
+      assert(passed | opposed | (attack_span_mask(Us, s) & theirPawns));
 
       // Test for candidate passed pawn
       candidate =   !(opposed | passed)
 
       // Test for candidate passed pawn
       candidate =   !(opposed | passed)
-                 && (b = outpost_mask(opposite_color(Us), s + pawn_push(Us)) & ourPawns) != EmptyBoardBB
-                 &&  count_1s_max_15(b) >= count_1s_max_15(outpost_mask(Us, s) & theirPawns);
+                 && (b = attack_span_mask(opposite_color(Us), s + pawn_push(Us)) & ourPawns) != EmptyBoardBB
+                 &&  count_1s_max_15(b) >= count_1s_max_15(attack_span_mask(Us, s) & theirPawns);
 
       // In order to prevent doubled passed pawns from receiving a too big
       // bonus, only the frontmost passed pawn on each file is considered as
 
       // In order to prevent doubled passed pawns from receiving a too big
       // bonus, only the frontmost passed pawn on each file is considered as
@@ -309,7 +309,7 @@ int PawnInfoTable::evaluate_pawn_storm(Square s, Rank r, File f, Bitboard theirP
   const int K = (Side == KingSide ? 2 : 4);
   const File RookFile = (Side == KingSide ? FILE_H : FILE_A);
 
   const int K = (Side == KingSide ? 2 : 4);
   const File RookFile = (Side == KingSide ? FILE_H : FILE_A);
 
-  Bitboard b = outpost_mask(Us, s) & theirPawns & StormFilesBB;
+  Bitboard b = attack_span_mask(Us, s) & theirPawns & StormFilesBB;
   int bonus = 0;
 
   while (b)
   int bonus = 0;
 
   while (b)
index 6472d73551c4ac272dfa12ee79d14c9b6681871a..234da26dbf72fa2d63f39ac66b9a10f8002e6c67 100644 (file)
@@ -483,7 +483,7 @@ inline bool Position::pawn_is_passed(Color c, Square s) const {
 }
 
 inline bool Position::square_is_weak(Square s, Color c) const {
 }
 
 inline bool Position::square_is_weak(Square s, Color c) const {
-  return !(pieces(PAWN, opposite_color(c)) & outpost_mask(c, s));
+  return !(pieces(PAWN, opposite_color(c)) & attack_span_mask(c, s));
 }
 
 inline Key Position::get_key() const {
 }
 
 inline Key Position::get_key() const {