mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Rename OutpostMask[] in AttackSpanMask[]
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>
This commit is contained in:
parent
9079bab84c
commit
0c9c5032e8
4 changed files with 17 additions and 18 deletions
|
@ -228,7 +228,7 @@ Bitboard BetweenBB[64][64];
|
||||||
|
|
||||||
Bitboard SquaresInFrontMask[2][64];
|
Bitboard SquaresInFrontMask[2][64];
|
||||||
Bitboard PassedPawnMask[2][64];
|
Bitboard PassedPawnMask[2][64];
|
||||||
Bitboard OutpostMask[2][64];
|
Bitboard AttackSpanMask[2][64];
|
||||||
|
|
||||||
Bitboard BishopPseudoAttacks[64];
|
Bitboard BishopPseudoAttacks[64];
|
||||||
Bitboard RookPseudoAttacks[64];
|
Bitboard RookPseudoAttacks[64];
|
||||||
|
@ -430,7 +430,7 @@ namespace {
|
||||||
{
|
{
|
||||||
SquaresInFrontMask[c][s] = in_front_bb(c, s) & file_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);
|
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++)
|
||||||
|
|
|
@ -76,7 +76,7 @@ extern Bitboard BetweenBB[64][64];
|
||||||
|
|
||||||
extern Bitboard SquaresInFrontMask[2][64];
|
extern Bitboard SquaresInFrontMask[2][64];
|
||||||
extern Bitboard PassedPawnMask[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 uint64_t RMult[64];
|
||||||
extern const int RShift[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
|
/// rank_bb() and file_bb() take a file or a square as input, and return
|
||||||
/// file or rank. It is also possible to pass a square as input to these
|
/// a bitboard representing all squares on the given file or rank.
|
||||||
/// functions.
|
|
||||||
|
|
||||||
inline Bitboard rank_bb(Rank r) {
|
inline Bitboard rank_bb(Rank r) {
|
||||||
return RankBB[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
|
/// attack_span_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
|
/// representing all squares that can be attacked by a pawn of the given color
|
||||||
/// be driven away by an enemy pawn. Definition of the table is:
|
/// when it moves along its file starting from the given square. Definition is:
|
||||||
/// OutpostMask[c][s] = in_front_bb(c, s) & neighboring_files_bb(s);
|
/// AttackSpanMask[c][s] = in_front_bb(c, s) & neighboring_files_bb(s);
|
||||||
|
|
||||||
inline Bitboard outpost_mask(Color c, Square s) {
|
inline Bitboard attack_span_mask(Color c, Square s) {
|
||||||
return OutpostMask[c][s];
|
return AttackSpanMask[c][s];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -231,7 +231,7 @@ Score PawnInfoTable::evaluate_pawns(const Position& pos, Bitboard ourPawns,
|
||||||
// there are friendly pawns behind on neighboring files it cannot
|
// there are friendly pawns behind on neighboring files it cannot
|
||||||
// be backward either.
|
// be backward either.
|
||||||
if ( (passed | isolated | chain)
|
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))
|
|| (pos.attacks_from<PAWN>(s, Us) & theirPawns))
|
||||||
backward = false;
|
backward = false;
|
||||||
else
|
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
|
// Test for candidate passed pawn
|
||||||
candidate = !(opposed | passed)
|
candidate = !(opposed | passed)
|
||||||
&& (b = outpost_mask(opposite_color(Us), s + pawn_push(Us)) & ourPawns) != EmptyBoardBB
|
&& (b = attack_span_mask(opposite_color(Us), s + pawn_push(Us)) & ourPawns) != EmptyBoardBB
|
||||||
&& count_1s_max_15(b) >= count_1s_max_15(outpost_mask(Us, s) & theirPawns);
|
&& 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
|
// In order to prevent doubled passed pawns from receiving a too big
|
||||||
// bonus, only the frontmost passed pawn on each file is considered as
|
// 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 int K = (Side == KingSide ? 2 : 4);
|
||||||
const File RookFile = (Side == KingSide ? FILE_H : FILE_A);
|
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;
|
int bonus = 0;
|
||||||
|
|
||||||
while (b)
|
while (b)
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Add table
Reference in a new issue