Skip to content

Commit 6e6c5b6

Browse files
R-Pelegmcostalba
authored andcommitted
Simplify chain detection
No functional change.
1 parent 04fd7ef commit 6e6c5b6

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/pawns.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ namespace {
9292
Bitboard b;
9393
Square s;
9494
File f;
95-
Rank r;
9695
bool passed, isolated, doubled, opposed, chain, backward, candidate;
9796
Score value = SCORE_ZERO;
9897
const Square* pl = pos.list<PAWN>(Us);
@@ -113,13 +112,12 @@ namespace {
113112
assert(pos.piece_on(s) == make_piece(Us, PAWN));
114113

115114
f = file_of(s);
116-
r = rank_of(s);
117115

118116
// This file cannot be semi-open
119117
e->semiopenFiles[Us] &= ~(1 << f);
120118

121119
// Our rank plus previous one. Used for chain detection
122-
b = rank_bb(r) | rank_bb(Us == WHITE ? r - Rank(1) : r + Rank(1));
120+
b = rank_bb(s) | rank_bb(s - pawn_push(Us));
123121

124122
// Flag the pawn as passed, isolated, doubled or member of a pawn
125123
// chain (but not the backward one).

0 commit comments

Comments
 (0)