]> git.sesse.net Git - stockfish/commitdiff
Use 'adjacent' instead of 'neighboring'
authorMarco Costalba <mcostalba@gmail.com>
Sat, 14 Jan 2012 17:03:57 +0000 (18:03 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 14 Jan 2012 17:04:13 +0000 (18:04 +0100)
It is more correct and specific. Another naming
improvement while reading Critter sources.

No functional changes.

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

index 5c6b6e026f25c2ddd4b68f0e4e6f85475a88a407..138d8c72b0c51dbe324397c98c1a13d65b5736f1 100644 (file)
@@ -40,8 +40,8 @@ Bitboard ClearMaskBB[65];
 
 Bitboard FileBB[8];
 Bitboard RankBB[8];
-Bitboard NeighboringFilesBB[8];
-Bitboard ThisAndNeighboringFilesBB[8];
+Bitboard AdjacentFilesBB[8];
+Bitboard ThisAndAdjacentFilesBB[8];
 Bitboard InFrontBB[2][8];
 Bitboard StepAttacksBB[16][64];
 Bitboard BetweenBB[64][64];
@@ -173,8 +173,8 @@ void bitboards_init() {
 
   for (int f = FILE_A; f <= FILE_H; f++)
   {
-      NeighboringFilesBB[f] = (f > FILE_A ? FileBB[f - 1] : 0) | (f < FILE_H ? FileBB[f + 1] : 0);
-      ThisAndNeighboringFilesBB[f] = FileBB[f] | NeighboringFilesBB[f];
+      AdjacentFilesBB[f] = (f > FILE_A ? FileBB[f - 1] : 0) | (f < FILE_H ? FileBB[f + 1] : 0);
+      ThisAndAdjacentFilesBB[f] = FileBB[f] | AdjacentFilesBB[f];
   }
 
   for (int rw = RANK_7, rb = RANK_2; rw >= RANK_1; rw--, rb++)
@@ -187,8 +187,8 @@ void bitboards_init() {
       for (Square s = SQ_A1; s <= SQ_H8; 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(file_of(s));
-          AttackSpanMask[c][s]     = in_front_bb(c, s) & neighboring_files_bb(file_of(s));
+          PassedPawnMask[c][s]     = in_front_bb(c, s) & this_and_adjacent_files_bb(file_of(s));
+          AttackSpanMask[c][s]     = in_front_bb(c, s) & adjacent_files_bb(file_of(s));
       }
 
   for (Square s1 = SQ_A1; s1 <= SQ_H8; s1++)
index ce198c22c4b9a628aefd18b3adcbe1b68cd46322..a00a0bdbb648649ca0216e55b49790a039aa330d 100644 (file)
@@ -24,8 +24,8 @@
 #include "types.h"
 
 extern Bitboard FileBB[8];
-extern Bitboard NeighboringFilesBB[8];
-extern Bitboard ThisAndNeighboringFilesBB[8];
+extern Bitboard AdjacentFilesBB[8];
+extern Bitboard ThisAndAdjacentFilesBB[8];
 extern Bitboard RankBB[8];
 extern Bitboard InFrontBB[2][8];
 
@@ -102,19 +102,19 @@ inline Bitboard file_bb(Square s) {
 }
 
 
-/// neighboring_files_bb takes a file as input and returns a bitboard representing
-/// all squares on the neighboring files.
+/// adjacent_files_bb takes a file as input and returns a bitboard representing
+/// all squares on the adjacent files.
 
-inline Bitboard neighboring_files_bb(File f) {
-  return NeighboringFilesBB[f];
+inline Bitboard adjacent_files_bb(File f) {
+  return AdjacentFilesBB[f];
 }
 
 
-/// this_and_neighboring_files_bb takes a file as input and returns a bitboard
-/// representing all squares on the given and neighboring files.
+/// this_and_adjacent_files_bb takes a file as input and returns a bitboard
+/// representing all squares on the given and adjacent files.
 
-inline Bitboard this_and_neighboring_files_bb(File f) {
-  return ThisAndNeighboringFilesBB[f];
+inline Bitboard this_and_adjacent_files_bb(File f) {
+  return ThisAndAdjacentFilesBB[f];
 }
 
 
@@ -197,7 +197,7 @@ inline Bitboard squares_in_front_of(Color c, Square s) {
 /// passed_pawn_mask takes a color and a square as input, and returns a
 /// bitboard mask which can be used to test if a pawn of the given color on
 /// the given square is a passed pawn. Definition of the table is:
-/// PassedPawnMask[c][s] = in_front_bb(c, s) & this_and_neighboring_files_bb(s)
+/// PassedPawnMask[c][s] = in_front_bb(c, s) & this_and_adjacent_files_bb(s)
 
 inline Bitboard passed_pawn_mask(Color c, Square s) {
   return PassedPawnMask[c][s];
@@ -207,7 +207,7 @@ inline Bitboard passed_pawn_mask(Color c, Square 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);
+/// AttackSpanMask[c][s] = in_front_bb(c, s) & adjacent_files_bb(s);
 
 inline Bitboard attack_span_mask(Color c, Square s) {
   return AttackSpanMask[c][s];
index 00c707267575d816c5c0d12750768b9fa9610038..a868c0e82cb31405befb810a5a7bd19a995e9249 100644 (file)
@@ -416,7 +416,7 @@ ScaleFactor Endgame<KBPsK>::operator()(const Position& pos) const {
           && abs(file_of(kingSq) - pawnFile) <= 1)
       {
           // The bishop has the wrong color, and the defending king is on the
-          // file of the pawn(s) or the neighboring file. Find the rank of the
+          // file of the pawn(s) or the adjacent file. Find the rank of the
           // frontmost pawn.
           Rank rank;
           if (strongerSide == WHITE)
@@ -768,7 +768,7 @@ ScaleFactor Endgame<KBPPKB>::operator()(const Position& pos) const {
         return SCALE_FACTOR_NONE;
 
   case 1:
-    // Pawns on neighboring files. Draw if defender firmly controls the square
+    // Pawns on adjacent files. Draw if defender firmly controls the square
     // in front of the frontmost pawn's path, and the square diagonally behind
     // this square on the file of the other pawn.
     if (   ksq == blockSq1
index 6f652c0a150c209a27b2f84478951cda4f46fccf..32469a916e8cc59b052ac9e3d1bca2f83c74900e 100644 (file)
@@ -841,7 +841,7 @@ namespace {
 
         // 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(file_of(s));
+        supportingPawns = pos.pieces(PAWN, Us) & adjacent_files_bb(file_of(s));
         if (supportingPawns & rank_bb(s))
             ebonus += Value(r * 20);
 
@@ -967,7 +967,7 @@ namespace {
         pliesToGo = 2 * movesToGo - int(loserSide == pos.side_to_move());
 
         // Generate list of blocking pawns and supporters
-        supporters = neighboring_files_bb(file_of(s)) & candidates;
+        supporters = adjacent_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);
 
index 35bc45aea2dd1f4105571db9aefb1a1fbc9b69ef..d000209fec7ccdbdb3fc9929f0016b43ec5ed535 100644 (file)
@@ -145,22 +145,22 @@ Score PawnInfoTable::evaluate_pawns(const Position& pos, Bitboard ourPawns,
       passed   = !(theirPawns & passed_pawn_mask(Us, s));
       doubled  =   ourPawns   & squares_in_front_of(Us, s);
       opposed  =   theirPawns & squares_in_front_of(Us, s);
-      isolated = !(ourPawns   & neighboring_files_bb(f));
-      chain    =   ourPawns   & neighboring_files_bb(f) & b;
+      isolated = !(ourPawns   & adjacent_files_bb(f));
+      chain    =   ourPawns   & adjacent_files_bb(f) & b;
 
       // Test for backward pawn
       backward = false;
 
       // If the pawn is passed, isolated, or member of a pawn chain it cannot
-      // be backward. If there are friendly pawns behind on neighboring files
+      // be backward. If there are friendly pawns behind on adjacent files
       // or if can capture an enemy pawn it cannot be backward either.
       if (   !(passed | isolated | chain)
           && !(ourPawns & attack_span_mask(Them, s))
           && !(pos.attacks_from<PAWN>(s, Us) & theirPawns))
       {
           // We now know that there are no friendly pawns beside or behind this
-          // pawn on neighboring files. We now check whether the pawn is
-          // backward by looking in the forward direction on the neighboring
+          // pawn on adjacent files. We now check whether the pawn is
+          // backward by looking in the forward direction on the adjacent
           // files, and seeing whether we meet a friendly or an enemy pawn first.
           b = pos.attacks_from<PAWN>(s, Us);
 
@@ -178,8 +178,8 @@ Score PawnInfoTable::evaluate_pawns(const Position& pos, Bitboard ourPawns,
 
       // A not passed pawn is a candidate to become passed if it is free to
       // advance and if the number of friendly pawns beside or behind this
-      // pawn on neighboring files is higher or equal than the number of
-      // enemy pawns in the forward direction on the neighboring files.
+      // pawn on adjacent files is higher or equal than the number of
+      // enemy pawns in the forward direction on the adjacent files.
       candidate =   !(opposed | passed | backward | isolated)
                  && (b = attack_span_mask(Them, s + pawn_push(Us)) & ourPawns) != 0
                  &&  popcount<Max15>(b) >= popcount<Max15>(attack_span_mask(Us, s) & theirPawns);
@@ -222,7 +222,7 @@ Score PawnInfo::updateShelter(const Position& pos, Square ksq) {
 
   if (relative_rank(Us, ksq) <= RANK_4)
   {
-      pawns = pos.pieces(PAWN, Us) & this_and_neighboring_files_bb(file_of(ksq));
+      pawns = pos.pieces(PAWN, Us) & this_and_adjacent_files_bb(file_of(ksq));
       r = ksq & (7 << 3);
       for (int i = 0; i < 3; i++)
       {