{
Move moves[1] = {MOVE_NONE};\r
Position pos(*it);
- think(pos, true, false, 0, 0, 0, 0, 0, secsPerPos * 1000, moves);\r
+ think(pos, true, false, 0, 0, 0, 0, 0, 0, secsPerPos * 1000, moves);\r
}
}
/// the program receives the UCI 'go' command. It initializes various
/// search-related global variables, and calls root_search()
-void think(const Position &pos, bool infinite, bool ponder, int time,
- int increment, int movesToGo, int maxDepth, int maxNodes,
- int maxTime, Move searchMoves[]) {
+void think(const Position &pos, bool infinite, bool ponder, int side_to_move,
+ int time[], int increment[], int movesToGo, int maxDepth,
+ int maxNodes, int maxTime, Move searchMoves[]) {
// Look for a book move:
if(!infinite && !ponder && get_option_value_bool("OwnBook")) {
assert(thread_is_available(i, 0));
// Set thinking time:
+ int myTime = time[side_to_move];
+ int myIncrement = increment[side_to_move];
+ int oppTime = time[1 - side_to_move];
+ int oppIncrement = increment[1 - side_to_move];
+
if(!movesToGo) { // Sudden death time control
if(increment) {
- MaxSearchTime = time / 30 + increment;
- AbsoluteMaxSearchTime = Max(time / 4, increment - 100);
+ MaxSearchTime = myTime / 30 + myIncrement;
+ AbsoluteMaxSearchTime = Max(myTime / 4, myIncrement - 100);
}
else { // Blitz game without increment
- MaxSearchTime = time / 40;
- AbsoluteMaxSearchTime = time / 8;
+ MaxSearchTime = myTime / 40;
+ AbsoluteMaxSearchTime = myTime / 8;
}
}
else { // (x moves) / (y minutes)
if(movesToGo == 1) {
- MaxSearchTime = time / 2;
- AbsoluteMaxSearchTime = Min(time / 2, time - 500);
+ MaxSearchTime = myTime / 2;
+ AbsoluteMaxSearchTime = Min(myTime / 2, myTime - 500);
}
else {
- MaxSearchTime = time / Min(movesToGo, 20);
- AbsoluteMaxSearchTime = Min((4 * time) / movesToGo, time / 3);
+ MaxSearchTime = myTime / Min(movesToGo, 20);
+ AbsoluteMaxSearchTime = Min((4 * myTime) / movesToGo, myTime / 3);
}
}
if(PonderingEnabled) {
extern void init_threads();
extern void stop_threads();
-extern void think(const Position &pos, bool infinite, bool ponder, int time,
- int increment, int movesToGo, int maxDepth, int maxNodes,
- int maxTime, Move searchMoves[]);
+extern void think(const Position &pos, bool infinite, bool ponder, int side_to_move,
+ int time[], int increment[], int movesToGo, int maxDepth,
+ int maxNodes, int maxTime, Move searchMoves[]);
extern int64_t nodes_searched();
TT.clear();
Position::init_piece_square_tables();
RootPosition.from_fen(StartPosition);
+
}
else if (token == "isready")
std::cout << "readyok" << std::endl;
if (moveTime)
infinite = true; // HACK
- think(RootPosition, infinite, ponder, time[RootPosition.side_to_move()],
- inc[RootPosition.side_to_move()], movesToGo, depth, nodes, moveTime,
- searchMoves);
+ think(RootPosition, infinite, ponder, RootPosition.side_to_move(), time,
+ inc, movesToGo, depth, nodes, moveTime, searchMoves);
}
}