summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9079bab)
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>
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];
{
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++)
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];
-/// 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];
-/// 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];
// 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
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
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;
}
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 {