Skip to content

Commit cf1f00e

Browse files
mcostalbaIIvec
authored andcommitted
Assorted cleanup of latest commits
No functional change. Resolves #601
1 parent 579e062 commit cf1f00e

File tree

6 files changed

+23
-22
lines changed

6 files changed

+23
-22
lines changed

src/evaluate.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ namespace {
467467
}
468468

469469

470-
// evaluate_threats() assigns bonuses according to the types of the attacking
470+
// evaluate_threats() assigns bonuses according to the types of the attacking
471471
// and the attacked pieces.
472472

473473
template<Color Us, bool DoTrace>
@@ -679,12 +679,12 @@ namespace {
679679
// status of the players.
680680
Score evaluate_initiative(const Position& pos, int asymmetry, Value eg) {
681681

682-
int kingDistance = distance<File>(pos.square<KING>(WHITE), pos.square<KING>(BLACK))
683-
- distance<Rank>(pos.square<KING>(WHITE), pos.square<KING>(BLACK));
682+
int kingDistance = distance<File>(pos.square<KING>(WHITE), pos.square<KING>(BLACK))
683+
- distance<Rank>(pos.square<KING>(WHITE), pos.square<KING>(BLACK));
684684
int pawns = pos.count<PAWN>(WHITE) + pos.count<PAWN>(BLACK);
685685

686686
// Compute the initiative bonus for the attacking side
687-
int initiative = 8 * (asymmetry + kingDistance) + 12 * pawns - 120;
687+
int initiative = 8 * (asymmetry + kingDistance - 15) + 12 * pawns;
688688

689689
// Now apply the bonus: note that we find the attacking side by extracting
690690
// the sign of the endgame value, and that we carefully cap the bonus so

src/movepick.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ namespace {
6868
/// ordering is at the current node.
6969

7070
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats& h,
71-
const CounterMoveStats& cmh, const CounterMoveStats& fmh, Move cm, Search::Stack* s)
72-
: pos(p), history(h), counterMoveHistory(&cmh), followupMoveHistory(&fmh), ss(s), countermove(cm), depth(d) {
71+
const CounterMoveStats& cmh, const CounterMoveStats& fmh,
72+
Move cm, Search::Stack* s)
73+
: pos(p), history(h), counterMoveHistory(&cmh),
74+
followupMoveHistory(&fmh), ss(s), countermove(cm), depth(d) {
7375

7476
assert(d > DEPTH_ZERO);
7577

@@ -80,7 +82,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats&
8082

8183
MovePicker::MovePicker(const Position& p, Move ttm, Depth d,
8284
const HistoryStats& h, Square s)
83-
: pos(p), history(h), counterMoveHistory(nullptr), followupMoveHistory(nullptr) {
85+
: pos(p), history(h) {
8486

8587
assert(d <= DEPTH_ZERO);
8688

@@ -105,7 +107,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d,
105107
}
106108

107109
MovePicker::MovePicker(const Position& p, Move ttm, const HistoryStats& h, Value th)
108-
: pos(p), history(h), counterMoveHistory(nullptr), followupMoveHistory(nullptr), threshold(th) {
110+
: pos(p), history(h), threshold(th) {
109111

110112
assert(!pos.checkers());
111113

@@ -142,7 +144,7 @@ void MovePicker::score<QUIETS>() {
142144

143145
for (auto& m : *this)
144146
m.value = history[pos.moved_piece(m)][to_sq(m)]
145-
+ (*counterMoveHistory)[pos.moved_piece(m)][to_sq(m)]
147+
+ (*counterMoveHistory )[pos.moved_piece(m)][to_sq(m)]
146148
+ (*followupMoveHistory)[pos.moved_piece(m)][to_sq(m)];
147149
}
148150

src/movepick.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ class MovePicker {
8383
MovePicker(const MovePicker&) = delete;
8484
MovePicker& operator=(const MovePicker&) = delete;
8585

86-
MovePicker(const Position&, Move, Depth, const HistoryStats&, Square);
8786
MovePicker(const Position&, Move, const HistoryStats&, Value);
88-
MovePicker(const Position&, Move, Depth, const HistoryStats&, const CounterMoveStats&, const CounterMoveStats&, Move, Search::Stack*);
87+
MovePicker(const Position&, Move, Depth, const HistoryStats&, Square);
88+
MovePicker(const Position&, Move, Depth, const HistoryStats&,
89+
const CounterMoveStats&, const CounterMoveStats&, Move, Search::Stack*);
8990

9091
Move next_move();
9192

src/pawns.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct Entry {
5353
}
5454

5555
template<Color Us>
56-
Score king_safety(const Position& pos, Square ksq) {
56+
Score king_safety(const Position& pos, Square ksq) {
5757
return kingSquares[Us] == ksq && castlingRights[Us] == pos.can_castle(Us)
5858
? kingSafety[Us] : (kingSafety[Us] = do_king_safety<Us>(pos, ksq));
5959
}

src/search.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,6 @@ namespace {
179179

180180
void Search::init() {
181181

182-
const bool PV=true;
183-
184182
for (int imp = 0; imp <= 1; ++imp)
185183
for (int d = 1; d < 64; ++d)
186184
for (int mc = 1; mc < 64; ++mc)
@@ -189,12 +187,12 @@ void Search::init() {
189187
if (r < 0.80)
190188
continue;
191189

192-
Reductions[!PV][imp][d][mc] = int(std::round(r)) * ONE_PLY;
193-
Reductions[PV][imp][d][mc] = std::max(Reductions[!PV][imp][d][mc] - ONE_PLY, DEPTH_ZERO);
194-
190+
Reductions[NonPV][imp][d][mc] = int(std::round(r)) * ONE_PLY;
191+
Reductions[PV][imp][d][mc] = std::max(Reductions[NonPV][imp][d][mc] - ONE_PLY, DEPTH_ZERO);
192+
195193
// Increase reduction for non-PV nodes when eval is not improving
196-
if (!imp && Reductions[!PV][imp][d][mc] >= 2 * ONE_PLY)
197-
Reductions[!PV][imp][d][mc] += ONE_PLY;
194+
if (!imp && Reductions[NonPV][imp][d][mc] >= 2 * ONE_PLY)
195+
Reductions[NonPV][imp][d][mc] += ONE_PLY;
198196
}
199197

200198
for (int d = 0; d < 16; ++d)
@@ -1429,8 +1427,8 @@ namespace {
14291427
}
14301428

14311429

1432-
// update_stats() updates killers, history, countermove and countermove
1433-
// history when a new quiet best move is found.
1430+
// update_stats() updates killers, history, countermove and countermove plus
1431+
// follow-up move history when a new quiet best move is found.
14341432

14351433
void update_stats(const Position& pos, Stack* ss, Move move,
14361434
Depth depth, Move* quiets, int quietsCnt) {

src/types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ inline Piece make_piece(Color c, PieceType pt) {
355355
return Piece((c << 3) | pt);
356356
}
357357

358-
inline PieceType type_of(Piece pc) {
358+
inline PieceType type_of(Piece pc) {
359359
return PieceType(pc & 7);
360360
}
361361

0 commit comments

Comments
 (0)