mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 01:03:09 +00:00
Cleanup code
This PR includes following cleanups: - Remove the unused depth variable in the thread class. - cleanup ValueList (added from mstembera) closes https://github.com/official-stockfish/Stockfish/pull/4127 No functional change.
This commit is contained in:
parent
e639c45577
commit
0a01dd044f
5 changed files with 5 additions and 18 deletions
|
@ -1114,7 +1114,6 @@ std::string Eval::trace(Position& pos) {
|
||||||
std::memset(scores, 0, sizeof(scores));
|
std::memset(scores, 0, sizeof(scores));
|
||||||
|
|
||||||
// Reset any global variable used in eval
|
// Reset any global variable used in eval
|
||||||
pos.this_thread()->depth = 0;
|
|
||||||
pos.this_thread()->trend = SCORE_ZERO;
|
pos.this_thread()->trend = SCORE_ZERO;
|
||||||
pos.this_thread()->bestValue = VALUE_ZERO;
|
pos.this_thread()->bestValue = VALUE_ZERO;
|
||||||
pos.this_thread()->optimism[WHITE] = VALUE_ZERO;
|
pos.this_thread()->optimism[WHITE] = VALUE_ZERO;
|
||||||
|
|
13
src/misc.h
13
src/misc.h
|
@ -116,23 +116,10 @@ class ValueList {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::size_t size() const { return size_; }
|
std::size_t size() const { return size_; }
|
||||||
void resize(std::size_t newSize) { size_ = newSize; }
|
|
||||||
void push_back(const T& value) { values_[size_++] = value; }
|
void push_back(const T& value) { values_[size_++] = value; }
|
||||||
T& operator[](std::size_t index) { return values_[index]; }
|
|
||||||
T* begin() { return values_; }
|
|
||||||
T* end() { return values_ + size_; }
|
|
||||||
const T& operator[](std::size_t index) const { return values_[index]; }
|
|
||||||
const T* begin() const { return values_; }
|
const T* begin() const { return values_; }
|
||||||
const T* end() const { return values_ + size_; }
|
const T* end() const { return values_ + size_; }
|
||||||
|
|
||||||
void swap(ValueList& other) {
|
|
||||||
const std::size_t maxSize = std::max(size_, other.size_);
|
|
||||||
for (std::size_t i = 0; i < maxSize; ++i) {
|
|
||||||
std::swap(values_[i], other.values_[i]);
|
|
||||||
}
|
|
||||||
std::swap(size_, other.size_);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T values_[MaxSize];
|
T values_[MaxSize];
|
||||||
std::size_t size_ = 0;
|
std::size_t size_ = 0;
|
||||||
|
|
|
@ -1099,10 +1099,12 @@ bool Position::see_ge(Move m, Value threshold) const {
|
||||||
// Don't allow pinned pieces to attack as long as there are
|
// Don't allow pinned pieces to attack as long as there are
|
||||||
// pinners on their original square.
|
// pinners on their original square.
|
||||||
if (pinners(~stm) & occupied)
|
if (pinners(~stm) & occupied)
|
||||||
|
{
|
||||||
stmAttackers &= ~blockers_for_king(stm);
|
stmAttackers &= ~blockers_for_king(stm);
|
||||||
|
|
||||||
if (!stmAttackers)
|
if (!stmAttackers)
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
res ^= 1;
|
res ^= 1;
|
||||||
|
|
||||||
|
|
|
@ -565,7 +565,6 @@ namespace {
|
||||||
|
|
||||||
// Step 1. Initialize node
|
// Step 1. Initialize node
|
||||||
Thread* thisThread = pos.this_thread();
|
Thread* thisThread = pos.this_thread();
|
||||||
thisThread->depth = depth;
|
|
||||||
ss->inCheck = pos.checkers();
|
ss->inCheck = pos.checkers();
|
||||||
priorCapture = pos.captured_piece();
|
priorCapture = pos.captured_piece();
|
||||||
Color us = pos.side_to_move();
|
Color us = pos.side_to_move();
|
||||||
|
|
|
@ -69,7 +69,7 @@ public:
|
||||||
Position rootPos;
|
Position rootPos;
|
||||||
StateInfo rootState;
|
StateInfo rootState;
|
||||||
Search::RootMoves rootMoves;
|
Search::RootMoves rootMoves;
|
||||||
Depth rootDepth, completedDepth, depth, previousDepth;
|
Depth rootDepth, completedDepth, previousDepth;
|
||||||
Value rootDelta;
|
Value rootDelta;
|
||||||
CounterMoveHistory counterMoves;
|
CounterMoveHistory counterMoves;
|
||||||
ButterflyHistory mainHistory;
|
ButterflyHistory mainHistory;
|
||||||
|
|
Loading…
Add table
Reference in a new issue