Skip to content

Commit db322e6

Browse files
committed
Revert "Store moves sent with "position" UCI command"
This reverts commit 0d68b52. After easy move semplification this machinery is not needed anymore (because of we don't need to know if a root move is a recapture) No functional change.
1 parent 45dba12 commit db322e6

File tree

6 files changed

+7
-16
lines changed

6 files changed

+7
-16
lines changed

src/benchmark.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ void benchmark(const Position& current, istream& is) {
114114

115115
int64_t nodes = 0;
116116
Search::StateStackPtr st;
117-
Search::MovesVectPtr mv;
118117
Time::point elapsed = Time::now();
119118

120119
for (size_t i = 0; i < fens.size(); i++)
@@ -131,7 +130,7 @@ void benchmark(const Position& current, istream& is) {
131130
}
132131
else
133132
{
134-
Threads.start_thinking(pos, limits, vector<Move>(), st, mv);
133+
Threads.start_thinking(pos, limits, vector<Move>(), st);
135134
Threads.wait_for_think_finished();
136135
nodes += Search::RootPos.nodes_searched();
137136
}

src/search.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ namespace Search {
4444
Color RootColor;
4545
Time::point SearchTime;
4646
StateStackPtr SetupStates;
47-
MovesVectPtr SetupMoves;
4847
}
4948

5049
using std::string;

src/search.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ struct SignalsType {
9393
};
9494

9595
typedef std::auto_ptr<std::stack<StateInfo> > StateStackPtr;
96-
typedef std::auto_ptr<std::vector<Move> > MovesVectPtr;
9796

9897
extern volatile SignalsType Signals;
9998
extern LimitsType Limits;
@@ -102,7 +101,6 @@ extern Position RootPos;
102101
extern Color RootColor;
103102
extern Time::point SearchTime;
104103
extern StateStackPtr SetupStates;
105-
extern MovesVectPtr SetupMoves;
106104

107105
extern void init();
108106
extern size_t perft(Position& pos, Depth depth);

src/thread.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ void ThreadPool::wait_for_think_finished() {
357357
// start_thinking() wakes up the main thread sleeping in MainThread::idle_loop()
358358
// so to start a new search, then returns immediately.
359359

360-
void ThreadPool::start_thinking(const Position& pos, const LimitsType& limits, const std::vector<Move>& searchMoves,
361-
StateStackPtr& setupStates, MovesVectPtr& setupMoves) {
360+
void ThreadPool::start_thinking(const Position& pos, const LimitsType& limits,
361+
const std::vector<Move>& searchMoves, StateStackPtr& states) {
362362
wait_for_think_finished();
363363

364364
SearchTime = Time::now(); // As early as possible
@@ -368,8 +368,7 @@ void ThreadPool::start_thinking(const Position& pos, const LimitsType& limits, c
368368

369369
RootPos = pos;
370370
Limits = limits;
371-
SetupStates = setupStates; // Ownership transfer here
372-
SetupMoves = setupMoves; // Ownership transfer here
371+
SetupStates = states; // Ownership transfer here
373372
RootMoves.clear();
374373

375374
for (MoveList<LEGAL> ml(pos); !ml.end(); ++ml)

src/thread.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ struct ThreadPool : public std::vector<Thread*> {
151151
void read_uci_options();
152152
Thread* available_slave(Thread* master) const;
153153
void wait_for_think_finished();
154-
void start_thinking(const Position&, const Search::LimitsType&, const std::vector<Move>&,
155-
Search::StateStackPtr&, Search::MovesVectPtr&);
154+
void start_thinking(const Position&, const Search::LimitsType&,
155+
const std::vector<Move>&, Search::StateStackPtr&);
156156

157157
bool sleepWhileIdle;
158158
Depth minimumSplitDepth;

src/uci.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ namespace {
4242
// Keep track of position keys along the setup moves (from start position to the
4343
// position just before to start searching). Needed by repetition draw detection.
4444
Search::StateStackPtr SetupStates;
45-
Search::MovesVectPtr SetupMoves;
4645

4746
void set_option(istringstream& up);
4847
void set_position(Position& pos, istringstream& up);
@@ -149,13 +148,10 @@ namespace {
149148

150149
pos.set(fen, Options["UCI_Chess960"], Threads.main_thread());
151150
SetupStates = Search::StateStackPtr(new std::stack<StateInfo>());
152-
SetupMoves = Search::MovesVectPtr(new std::vector<Move>());
153-
SetupMoves->reserve(200); // Try to avoid reallocations
154151

155152
// Parse move list (if any)
156153
while (is >> token && (m = move_from_uci(pos, token)) != MOVE_NONE)
157154
{
158-
SetupMoves->push_back(m);
159155
SetupStates->push(StateInfo());
160156
pos.do_move(m, SetupStates->top());
161157
}
@@ -215,6 +211,6 @@ namespace {
215211
else if (token == "ponder") limits.ponder = true;
216212
}
217213

218-
Threads.start_thinking(pos, limits, searchMoves, SetupStates, SetupMoves);
214+
Threads.start_thinking(pos, limits, searchMoves, SetupStates);
219215
}
220216
}

0 commit comments

Comments
 (0)