Skip to content

Commit

Permalink
Assorted cleanups
Browse files Browse the repository at this point in the history
Assorted cleanups

closes official-stockfish#5046

No functional change

Co-Authored-By: Shahin M. Shahin <41402573+peregrineshahin@users.noreply.github.com>
Co-Authored-By: cj5716 <125858804+cj5716@users.noreply.github.com>
  • Loading branch information
3 people authored and Viren6 committed Feb 12, 2024
1 parent 125d476 commit 4f663c1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 18 deletions.
3 changes: 0 additions & 3 deletions src/bitboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ inline Bitboard pawn_attacks_bb(Color c, Square s) {
inline Bitboard line_bb(Square s1, Square s2) {

assert(is_ok(s1) && is_ok(s2));

return LineBB[s1][s2];
}

Expand All @@ -178,7 +177,6 @@ inline Bitboard line_bb(Square s1, Square s2) {
inline Bitboard between_bb(Square s1, Square s2) {

assert(is_ok(s1) && is_ok(s2));

return BetweenBB[s1][s2];
}

Expand Down Expand Up @@ -216,7 +214,6 @@ template<PieceType Pt>
inline Bitboard attacks_bb(Square s) {

assert((Pt != PAWN) && (is_ok(s)));

return PseudoAttacks[Pt][s];
}

Expand Down
2 changes: 1 addition & 1 deletion src/evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ Value Eval::evaluate(const Position& pos, int optimism) {
v = v * (200 - shuffling) / 214;

// Guarantee evaluation does not hit the tablebase range
v = std::clamp(int(v), VALUE_TB_LOSS_IN_MAX_PLY + 1, VALUE_TB_WIN_IN_MAX_PLY - 1);
v = std::clamp(v, VALUE_TB_LOSS_IN_MAX_PLY + 1, VALUE_TB_WIN_IN_MAX_PLY - 1);

return v;
}
Expand Down
2 changes: 1 addition & 1 deletion src/movepick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void MovePicker::score() {
else if constexpr (Type == QUIETS)
{
Piece pc = pos.moved_piece(m);
PieceType pt = type_of(pos.moved_piece(m));
PieceType pt = type_of(pc);
Square from = m.from_sq();
Square to = m.to_sq();

Expand Down
2 changes: 0 additions & 2 deletions src/position.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,11 @@ inline CastlingRights Position::castling_rights(Color c) const {

inline bool Position::castling_impeded(CastlingRights cr) const {
assert(cr == WHITE_OO || cr == WHITE_OOO || cr == BLACK_OO || cr == BLACK_OOO);

return pieces() & castlingPath[cr];
}

inline Square Position::castling_rook_square(CastlingRights cr) const {
assert(cr == WHITE_OO || cr == WHITE_OOO || cr == BLACK_OO || cr == BLACK_OOO);

return castlingRookSquare[cr];
}

Expand Down
18 changes: 7 additions & 11 deletions src/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ enum NodeType {
class TranspositionTable;
class ThreadPool;
class OptionsMap;
class UCI;

namespace Search {

Expand Down Expand Up @@ -124,10 +123,12 @@ struct LimitsType {
// The UCI stores the uci options, thread pool, and transposition table.
// This struct is used to easily forward data to the Search::Worker class.
struct SharedState {
SharedState(const OptionsMap& o, ThreadPool& tp, TranspositionTable& t) :
options(o),
threads(tp),
tt(t) {}
SharedState(const OptionsMap& optionsMap,
ThreadPool& threadPool,
TranspositionTable& transpositionTable) :
options(optionsMap),
threads(threadPool),
tt(transpositionTable) {}

const OptionsMap& options;
ThreadPool& threads;
Expand Down Expand Up @@ -209,11 +210,7 @@ class Worker {
template<NodeType nodeType>
Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth = 0);

Depth reduction(bool i, Depth d, int mn, int delta) {
int reductionScale = reductions[d] * reductions[mn];
return (reductionScale + 1177 - int(delta) * 776 / int(rootDelta)) / 1024
+ (!i && reductionScale > 842);
}
Depth reduction(bool i, Depth d, int mn, int delta);

// Get a pointer to the search manager, only allowed to be called by the
// main thread.
Expand Down Expand Up @@ -251,7 +248,6 @@ class Worker {
TranspositionTable& tt;

friend class Stockfish::ThreadPool;
friend class Stockfish::UCI;
friend class SearchManager;
};

Expand Down

0 comments on commit 4f663c1

Please sign in to comment.