From: Marco Costalba Date: Sat, 14 Jan 2012 17:03:57 +0000 (+0100) Subject: Use 'adjacent' instead of 'neighboring' X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=3ec94abcdb5f4ad81cc8829aece2d7fa64bb21db Use 'adjacent' instead of 'neighboring' It is more correct and specific. Another naming improvement while reading Critter sources. No functional changes. Signed-off-by: Marco Costalba --- diff --git a/src/bitboard.cpp b/src/bitboard.cpp index 5c6b6e02..138d8c72 100644 --- a/src/bitboard.cpp +++ b/src/bitboard.cpp @@ -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++) diff --git a/src/bitboard.h b/src/bitboard.h index ce198c22..a00a0bdb 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -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]; diff --git a/src/endgame.cpp b/src/endgame.cpp index 00c70726..a868c0e8 100644 --- a/src/endgame.cpp +++ b/src/endgame.cpp @@ -416,7 +416,7 @@ ScaleFactor Endgame::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::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 diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 6f652c0a..32469a91 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -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); diff --git a/src/pawns.cpp b/src/pawns.cpp index 35bc45ae..d000209f 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -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(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(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(b) >= popcount(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++) {