Skip to content

Commit

Permalink
Simplify the shelter mask
Browse files Browse the repository at this point in the history
The line 246 of pawns.cpp is not necessary, because we restrict the bitboards
to file_of(f) in lines 253 and 256 anyway.

No functional change.
  • Loading branch information
snicolet committed Apr 18, 2018
1 parent 66af809 commit 73e8daa
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/pawns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,12 @@ Value Entry::shelter_storm(const Position& pos, Square ksq) {

enum { BlockedByKing, Unopposed, BlockedByPawn, Unblocked };

File center = std::max(FILE_B, std::min(FILE_G, file_of(ksq)));
Bitboard b = pos.pieces(PAWN)
& (forward_ranks_bb(Us, ksq) | rank_bb(ksq))
& (adjacent_files_bb(center) | file_bb(center));
Bitboard b = pos.pieces(PAWN) & (forward_ranks_bb(Us, ksq) | rank_bb(ksq));
Bitboard ourPawns = b & pos.pieces(Us);
Bitboard theirPawns = b & pos.pieces(Them);
Value safety = MaxSafetyBonus;

File center = std::max(FILE_B, std::min(FILE_G, file_of(ksq)));
for (File f = File(center - 1); f <= File(center + 1); ++f)
{
b = ourPawns & file_bb(f);
Expand Down

0 comments on commit 73e8daa

Please sign in to comment.