Revert "Store moves sent with "position" UCI command"
authorMarco Costalba <mcostalba@gmail.com>
Mon, 4 Mar 2013 08:28:21 +0000 (09:28 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 4 Mar 2013 08:29:46 +0000 (09:29 +0100)
This reverts commit 0d68b523a390e2f5c37f211316869d798e852289.

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.

src/benchmark.cpp
src/search.cpp
src/search.h
src/thread.cpp
src/thread.h
src/uci.cpp

index fa0aa3e9e761d7afdd986413d0be8617380b2818..25dab6cc7d7bd8b026b57633e6b31364b76bbb9b 100644 (file)
@@ -114,7 +114,6 @@ void benchmark(const Position& current, istream& is) {
 
   int64_t nodes = 0;
   Search::StateStackPtr st;
-  Search::MovesVectPtr mv;
   Time::point elapsed = Time::now();
 
   for (size_t i = 0; i < fens.size(); i++)
@@ -131,7 +130,7 @@ void benchmark(const Position& current, istream& is) {
       }
       else
       {
-          Threads.start_thinking(pos, limits, vector<Move>(), st, mv);
+          Threads.start_thinking(pos, limits, vector<Move>(), st);
           Threads.wait_for_think_finished();
           nodes += Search::RootPos.nodes_searched();
       }
index ab88142ff8fe305de9a23889afc0b772ad777efa..fc3ecae4d87e5c56230aec04a8bb6aacbee50cc0 100644 (file)
@@ -44,7 +44,6 @@ namespace Search {
   Color RootColor;
   Time::point SearchTime;
   StateStackPtr SetupStates;
-  MovesVectPtr SetupMoves;
 }
 
 using std::string;
index 73fa79aea88e6c4adda13665095696d14bb9ec4b..bd21023747f53d2e480003933566c86fbd844bf8 100644 (file)
@@ -93,7 +93,6 @@ struct SignalsType {
 };
 
 typedef std::auto_ptr<std::stack<StateInfo> > StateStackPtr;
-typedef std::auto_ptr<std::vector<Move> > MovesVectPtr;
 
 extern volatile SignalsType Signals;
 extern LimitsType Limits;
@@ -102,7 +101,6 @@ extern Position RootPos;
 extern Color RootColor;
 extern Time::point SearchTime;
 extern StateStackPtr SetupStates;
-extern MovesVectPtr SetupMoves;
 
 extern void init();
 extern size_t perft(Position& pos, Depth depth);
index 0d8070f202b0774d5077b4ec26962d54f438f7c4..f5b8b5e275aff3313b74ae061fd8b4455d98dab8 100644 (file)
@@ -357,8 +357,8 @@ void ThreadPool::wait_for_think_finished() {
 // start_thinking() wakes up the main thread sleeping in MainThread::idle_loop()
 // so to start a new search, then returns immediately.
 
-void ThreadPool::start_thinking(const Position& pos, const LimitsType& limits, const std::vector<Move>& searchMoves,
-                                StateStackPtr& setupStates, MovesVectPtr& setupMoves) {
+void ThreadPool::start_thinking(const Position& pos, const LimitsType& limits,
+                                const std::vector<Move>& searchMoves, StateStackPtr& states) {
   wait_for_think_finished();
 
   SearchTime = Time::now(); // As early as possible
@@ -368,8 +368,7 @@ void ThreadPool::start_thinking(const Position& pos, const LimitsType& limits, c
 
   RootPos = pos;
   Limits = limits;
-  SetupStates = setupStates; // Ownership transfer here
-  SetupMoves = setupMoves;   // Ownership transfer here
+  SetupStates = states; // Ownership transfer here
   RootMoves.clear();
 
   for (MoveList<LEGAL> ml(pos); !ml.end(); ++ml)
index ac6040f285cb8705bac9881a6c0988840497db07..fbd3b7f4af2e58509ae1530ab6ad6efe8bbbbb76 100644 (file)
@@ -151,8 +151,8 @@ struct ThreadPool : public std::vector<Thread*> {
   void read_uci_options();
   Thread* available_slave(Thread* master) const;
   void wait_for_think_finished();
-  void start_thinking(const Position&, const Search::LimitsType&, const std::vector<Move>&,
-                      Search::StateStackPtr&, Search::MovesVectPtr&);
+  void start_thinking(const Position&, const Search::LimitsType&,
+                      const std::vector<Move>&, Search::StateStackPtr&);
 
   bool sleepWhileIdle;
   Depth minimumSplitDepth;
index 3a33b9f4a07170828a9f55ac5af228a1aa930257..c8f504463cef969db7a72c9816d3c23fd6f18b94 100644 (file)
@@ -42,7 +42,6 @@ namespace {
   // Keep track of position keys along the setup moves (from start position to the
   // position just before to start searching). Needed by repetition draw detection.
   Search::StateStackPtr SetupStates;
-  Search::MovesVectPtr SetupMoves;
 
   void set_option(istringstream& up);
   void set_position(Position& pos, istringstream& up);
@@ -149,13 +148,10 @@ namespace {
 
     pos.set(fen, Options["UCI_Chess960"], Threads.main_thread());
     SetupStates = Search::StateStackPtr(new std::stack<StateInfo>());
-    SetupMoves = Search::MovesVectPtr(new std::vector<Move>());
-    SetupMoves->reserve(200); // Try to avoid reallocations
 
     // Parse move list (if any)
     while (is >> token && (m = move_from_uci(pos, token)) != MOVE_NONE)
     {
-        SetupMoves->push_back(m);
         SetupStates->push(StateInfo());
         pos.do_move(m, SetupStates->top());
     }
@@ -215,6 +211,6 @@ namespace {
         else if (token == "ponder")    limits.ponder = true;
     }
 
-    Threads.start_thinking(pos, limits, searchMoves, SetupStates, SetupMoves);
+    Threads.start_thinking(pos, limits, searchMoves, SetupStates);
   }
 }