Skip to content

Commit e917bd5

Browse files
protonspringmcostalba
authored andcommitted
Changes identified in RENAME/REFORMATTING thread (#1861)
I've gone through the RENAME/REFORMATTING thread and changed everything I could find, plus a few more. With this, let's close the previous issue and open another. No functional change.
1 parent e8ffca3 commit e917bd5

File tree

11 files changed

+38
-38
lines changed

11 files changed

+38
-38
lines changed

AUTHORS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Michael Chaly (Vizvezdenec)
8888
Michel Van den Bergh (vdbergh)
8989
Miguel Lahoz (miguel-l)
9090
Mikael Bäckman (mbootsector)
91-
Mike Whiteley (protonspring)
91+
Michael Whiteley (protonspring)
9292
Miroslav Fontán (Hexik)
9393
Moez Jellouli (MJZ1977)
9494
Mohammed Li (tthsqe12)

src/evaluate.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ namespace {
381381
{
382382
File kf = file_of(pos.square<KING>(Us));
383383
if ((kf < FILE_E) == (file_of(s) < kf))
384-
score -= (TrappedRook - make_score(mob * 22, 0)) * (1 + !pos.can_castle(Us));
384+
score -= (TrappedRook - make_score(mob * 22, 0)) * (1 + !pos.castling_rights(Us));
385385
}
386386
}
387387

@@ -512,7 +512,7 @@ namespace {
512512
Score score = SCORE_ZERO;
513513

514514
// Non-pawn enemies
515-
nonPawnEnemies = pos.pieces(Them) ^ pos.pieces(Them, PAWN);
515+
nonPawnEnemies = pos.pieces(Them) & ~pos.pieces(Them, PAWN);
516516

517517
// Squares strongly protected by the enemy, either because they defend the
518518
// square with a pawn, or because they defend the square twice and we don't.

src/material.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ struct Entry {
5858
Key key;
5959
const EndgameBase<Value>* evaluationFunction;
6060
const EndgameBase<ScaleFactor>* scalingFunction[COLOR_NB]; // Could be one for each
61-
// side (e.g. KPKP, KBPsKs)
61+
// side (e.g. KPKP, KBPsK)
6262
int16_t value;
6363
uint8_t factor[COLOR_NB];
6464
Phase gamePhase;

src/movegen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ namespace {
278278
*moveList++ = make_move(ksq, pop_lsb(&b));
279279
}
280280

281-
if (Type != CAPTURES && Type != EVASIONS && pos.can_castle(Us))
281+
if (Type != CAPTURES && Type != EVASIONS && pos.castling_rights(Us))
282282
{
283283
if (pos.is_chess960())
284284
{

src/pawns.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ namespace {
6767
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
6868
constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH);
6969

70-
Bitboard b, neighbours, stoppers, doubled, supported, phalanx;
70+
Bitboard b, neighbours, stoppers, doubled, support, phalanx;
7171
Bitboard lever, leverPush;
7272
Square s;
7373
bool opposed, backward;
@@ -102,7 +102,7 @@ namespace {
102102
doubled = ourPawns & (s - Up);
103103
neighbours = ourPawns & adjacent_files_bb(f);
104104
phalanx = neighbours & rank_bb(s);
105-
supported = neighbours & rank_bb(s - Up);
105+
support = neighbours & rank_bb(s - Up);
106106

107107
// A pawn is backward when it is behind all pawns of the same color
108108
// on the adjacent files and cannot be safely advanced.
@@ -114,30 +114,30 @@ namespace {
114114
// which could become passed after one or two pawn pushes when are
115115
// not attacked more times than defended.
116116
if ( !(stoppers ^ lever ^ leverPush)
117-
&& popcount(supported) >= popcount(lever) - 1
117+
&& popcount(support) >= popcount(lever) - 1
118118
&& popcount(phalanx) >= popcount(leverPush))
119119
e->passedPawns[Us] |= s;
120120

121121
else if ( stoppers == SquareBB[s + Up]
122122
&& relative_rank(Us, s) >= RANK_5)
123123
{
124-
b = shift<Up>(supported) & ~theirPawns;
124+
b = shift<Up>(support) & ~theirPawns;
125125
while (b)
126126
if (!more_than_one(theirPawns & PawnAttacks[Us][pop_lsb(&b)]))
127127
e->passedPawns[Us] |= s;
128128
}
129129

130130
// Score this pawn
131-
if (supported | phalanx)
132-
score += Connected[opposed][bool(phalanx)][popcount(supported)][relative_rank(Us, s)];
131+
if (support | phalanx)
132+
score += Connected[opposed][bool(phalanx)][popcount(support)][relative_rank(Us, s)];
133133

134134
else if (!neighbours)
135135
score -= Isolated, e->weakUnopposed[Us] += !opposed;
136136

137137
else if (backward)
138138
score -= Backward, e->weakUnopposed[Us] += !opposed;
139139

140-
if (doubled && !supported)
140+
if (doubled && !support)
141141
score -= Doubled;
142142
}
143143

@@ -214,10 +214,10 @@ Value Entry::evaluate_shelter(const Position& pos, Square ksq) {
214214
for (File f = File(center - 1); f <= File(center + 1); ++f)
215215
{
216216
b = ourPawns & file_bb(f);
217-
int ourRank = b ? relative_rank(Us, backmost_sq(Us, b)) : 0;
217+
Rank ourRank = b ? relative_rank(Us, backmost_sq(Us, b)) : RANK_1;
218218

219219
b = theirPawns & file_bb(f);
220-
int theirRank = b ? relative_rank(Us, frontmost_sq(Them, b)) : 0;
220+
Rank theirRank = b ? relative_rank(Us, frontmost_sq(Them, b)) : RANK_1;
221221

222222
int d = std::min(f, ~f);
223223
safety += ShelterStrength[d][ourRank];
@@ -237,7 +237,7 @@ Score Entry::do_king_safety(const Position& pos) {
237237

238238
Square ksq = pos.square<KING>(Us);
239239
kingSquares[Us] = ksq;
240-
castlingRights[Us] = pos.can_castle(Us);
240+
castlingRights[Us] = pos.castling_rights(Us);
241241
int minKingPawnDistance = 0;
242242

243243
Bitboard pawns = pos.pieces(Us, PAWN);

src/pawns.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct Entry {
5151

5252
template<Color Us>
5353
Score king_safety(const Position& pos) {
54-
return kingSquares[Us] == pos.square<KING>(Us) && castlingRights[Us] == pos.can_castle(Us)
54+
return kingSquares[Us] == pos.square<KING>(Us) && castlingRights[Us] == pos.castling_rights(Us)
5555
? kingSafety[Us] : (kingSafety[Us] = do_king_safety<Us>(pos));
5656
}
5757

src/position.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ const string Position::fen() const {
476476
if (can_castle(BLACK_OOO))
477477
ss << (chess960 ? char('a' + file_of(castling_rook_square(BLACK | QUEEN_SIDE))) : 'q');
478478

479-
if (!can_castle(WHITE) && !can_castle(BLACK))
479+
if (!can_castle(ANY_CASTLING))
480480
ss << '-';
481481

482482
ss << (ep_square() == SQ_NONE ? " - " : " " + UCI::square(ep_square()) + " ")

src/position.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ class Position {
9797
template<PieceType Pt> Square square(Color c) const;
9898

9999
// Castling
100-
int can_castle(Color c) const;
101-
int can_castle(CastlingRight cr) const;
100+
int castling_rights(Color c) const;
101+
bool can_castle(CastlingRight cr) const;
102102
bool castling_impeded(CastlingRight cr) const;
103103
Square castling_rook_square(CastlingRight cr) const;
104104

@@ -260,11 +260,11 @@ inline Square Position::ep_square() const {
260260
return st->epSquare;
261261
}
262262

263-
inline int Position::can_castle(CastlingRight cr) const {
263+
inline bool Position::can_castle(CastlingRight cr) const {
264264
return st->castlingRights & cr;
265265
}
266266

267-
inline int Position::can_castle(Color c) const {
267+
inline int Position::castling_rights(Color c) const {
268268
return st->castlingRights & ((WHITE_OO | WHITE_OOO) << (2 * c));
269269
}
270270

src/search.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -826,8 +826,8 @@ namespace {
826826
&& depth >= 5 * ONE_PLY
827827
&& abs(beta) < VALUE_MATE_IN_MAX_PLY)
828828
{
829-
Value rbeta = std::min(beta + 216 - 48 * improving, VALUE_INFINITE);
830-
MovePicker mp(pos, ttMove, rbeta - ss->staticEval, &thisThread->captureHistory);
829+
Value raisedBeta = std::min(beta + 216 - 48 * improving, VALUE_INFINITE);
830+
MovePicker mp(pos, ttMove, raisedBeta - ss->staticEval, &thisThread->captureHistory);
831831
int probCutCount = 0;
832832

833833
while ( (move = mp.next_move()) != MOVE_NONE
@@ -844,15 +844,15 @@ namespace {
844844
pos.do_move(move, st);
845845

846846
// Perform a preliminary qsearch to verify that the move holds
847-
value = -qsearch<NonPV>(pos, ss+1, -rbeta, -rbeta+1);
847+
value = -qsearch<NonPV>(pos, ss+1, -raisedBeta, -raisedBeta+1);
848848

849849
// If the qsearch held perform the regular search
850-
if (value >= rbeta)
851-
value = -search<NonPV>(pos, ss+1, -rbeta, -rbeta+1, depth - 4 * ONE_PLY, !cutNode);
850+
if (value >= raisedBeta)
851+
value = -search<NonPV>(pos, ss+1, -raisedBeta, -raisedBeta+1, depth - 4 * ONE_PLY, !cutNode);
852852

853853
pos.undo_move(move);
854854

855-
if (value >= rbeta)
855+
if (value >= raisedBeta)
856856
return value;
857857
}
858858
}
@@ -928,18 +928,18 @@ namespace {
928928
if ( depth >= 8 * ONE_PLY
929929
&& move == ttMove
930930
&& !rootNode
931-
&& !excludedMove // Recursive singular search is not allowed
931+
&& !excludedMove // Avoid recursive singular search
932932
&& ttValue != VALUE_NONE
933933
&& (tte->bound() & BOUND_LOWER)
934934
&& tte->depth() >= depth - 3 * ONE_PLY
935935
&& pos.legal(move))
936936
{
937-
Value rBeta = std::max(ttValue - 2 * depth / ONE_PLY, -VALUE_MATE);
937+
Value reducedBeta = std::max(ttValue - 2 * depth / ONE_PLY, -VALUE_MATE);
938938
ss->excludedMove = move;
939-
value = search<NonPV>(pos, ss, rBeta - 1, rBeta, depth / 2, cutNode);
939+
value = search<NonPV>(pos, ss, reducedBeta - 1, reducedBeta, depth / 2, cutNode);
940940
ss->excludedMove = MOVE_NONE;
941941

942-
if (value < rBeta)
942+
if (value < reducedBeta)
943943
extension = ONE_PLY;
944944
}
945945
else if ( givesCheck // Check extension (~2 Elo)
@@ -1186,9 +1186,9 @@ namespace {
11861186
update_capture_stats(pos, bestMove, capturesSearched, captureCount, stat_bonus(depth + ONE_PLY));
11871187

11881188
// Extra penalty for a quiet TT or main killer move in previous ply when it gets refuted
1189-
if ( (ss-1)->moveCount == 1
1190-
|| ((ss-1)->currentMove == (ss-1)->killers[0] && (ss-1)->killers[0]))
1191-
if (!pos.captured_piece())
1189+
if ( (ss-1)->moveCount == 1
1190+
|| ((ss-1)->currentMove == (ss-1)->killers[0] && (ss-1)->killers[0]))
1191+
if (!pos.captured_piece())
11921192
update_continuation_histories(ss-1, pos.piece_on(prevSq), prevSq, -stat_bonus(depth + ONE_PLY));
11931193

11941194
}

src/syzygy/tbprobe.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,10 +1107,10 @@ void* mapped(TBTable<Type>& e, const Position& pos) {
11071107

11081108
static Mutex mutex;
11091109

1110-
// Use 'aquire' to avoid a thread reads 'ready' == true while another is
1111-
// still working, this could happen due to compiler reordering.
1110+
// Use 'acquire' to avoid a thread reading 'ready' == true while
1111+
// another is still working. (compiler reordering may cause this).
11121112
if (e.ready.load(std::memory_order_acquire))
1113-
return e.baseAddress; // Could be nullptr if file does not exsist
1113+
return e.baseAddress; // Could be nullptr if file does not exist
11141114

11151115
std::unique_lock<Mutex> lk(mutex);
11161116

0 commit comments

Comments
 (0)