X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fuci.cpp;h=9c13eff7abfdf2ced889d5273c3e1e3651160284;hp=4aade3b66bb99cbcdb261089519443f7c8e48c11;hb=2155fb78256204aae5aa80946dfe7d8d9c6e2397;hpb=d3600c39a745179ed6b094b305d0645e83a1ee86 diff --git a/src/uci.cpp b/src/uci.cpp index 4aade3b6..9c13eff7 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -22,6 +22,7 @@ //// Includes //// +#include #include #include #include @@ -118,7 +119,6 @@ namespace { if (token == "quit") { - OpeningBook.close(); stop_threads(); quit_eval(); exit(0); @@ -169,7 +169,7 @@ namespace { } else if (token == "key") { - std::cout << "key: " << RootPosition.get_key() + std::cout << "key: " << std::hex << RootPosition.get_key() << " material key: " << RootPosition.get_material_key() << " pawn key: " << RootPosition.get_pawn_key() << std::endl; @@ -219,15 +219,18 @@ namespace { if (token == "moves") { Move move; - UndoInfo u; + StateInfo st; while (!uip.eof()) { uip >> token; move = move_from_string(RootPosition, token); - RootPosition.do_move(move, u); + RootPosition.do_move(move, st); if (RootPosition.rule_50_counter() == 0) RootPosition.reset_game_ply(); } + // Our StateInfo st is about going out of scope, + // so save its content before they disappear. + RootPosition.setStartState(st); } } } @@ -247,11 +250,13 @@ namespace { if (token == "name") { uip >> name; - uip >> token; - while (!uip.eof() && token != "value") + while (!uip.eof()) { - name += (" " + token); - uip >> token; + uip >> token; + if (token == "value") + break; + + name += (" " + token); } if (token == "value") { @@ -321,6 +326,8 @@ namespace { if (moveTime) infinite = true; // HACK + assert(RootPosition.is_ok()); + think(RootPosition, infinite, ponder, RootPosition.side_to_move(), time, inc, movesToGo, depth, nodes, moveTime, searchMoves); }