- think(RootPosition, infinite, ponder, time[RootPosition.side_to_move()],
- inc[RootPosition.side_to_move()], movesToGo, depth, nodes, moveTime,
- searchMoves);
+ assert(RootPosition.is_ok());
+
+ return think(RootPosition, infinite, ponder, RootPosition.side_to_move(),
+ time, inc, movesToGo, depth, nodes, moveTime, searchMoves);
+ }
+
+ void perft(UCIInputParser& uip) {
+
+ string token;
+ int depth, tm, n;
+ Position pos = RootPosition;
+
+ if (uip.eof())
+ return;
+
+ uip >> depth;
+ tm = get_system_time();
+
+ n = perft(pos, depth * OnePly);
+
+ tm = get_system_time() - tm;
+ std::cout << "\nNodes " << n
+ << "\nTime (ms) " << tm
+ << "\nNodes/second " << (int)(n/(tm/1000.0)) << std::endl;