nicolaswinkler 7 years ago
parent
commit
dc1b79fb7e
2 changed files with 12 additions and 6 deletions
  1. 10 5
      src/UciParser.cpp
  2. 2 1
      src/UciParser.h

+ 10 - 5
src/UciParser.cpp

@@ -151,22 +151,27 @@ void UciParser::position(const vector<string>& args)
 
 void UciParser::go(const vector<string>& args)
 {
-    chessy::Move m = minimax.calculateBest(5);
+    fst = make_unique<FixedSearchTimer>(cg, *this);
+
+    fst->setThinkTime(std::chrono::milliseconds{ 1000 });
+    fst->startSearch();
+
+    //chessy::Move m = minimax.calculateBest(5);
 
     // TODO: hack!
-    string suffix;
+    /*string suffix;
     if (cg.getBoard().getAtPosition(m.origin) == chessy::PieceType::PAWN &&
         (m.destination.index < 8 || m.destination.index >= 56)) {
             suffix = "Q";
-    }
+    }*/
 
-    sendCommand("bestmove", { m.asString() + suffix });
+    //sendCommand("bestmove", { m.asString() + suffix });
 }
 
 
 void UciParser::stop(const vector<string>& args)
 {
-
+    
 }
 
 

+ 2 - 1
src/UciParser.h

@@ -2,6 +2,7 @@
 #define UCIPARSER_H
 
 #include <iostream>
+#include <utility>
 #include <vector>
 #include <string>
 #include <algorithm>
@@ -55,7 +56,7 @@ class UciParser
     chessy::ChessGame cg;
     chessy::MiniMax minimax{ cg };
 
-    FixedSearchTimer fst{ cg, *this };
+    std::unique_ptr<FixedSearchTimer> fst;
 public:
     inline UciParser(std::istream& in = std::cin, std::ostream& out = std::cout) :
         in{ in }, out{ out } {}