-/// be used, the limit value spent for each position (optional, default
-/// is ply 12), an optional file name where to look for positions in fen
-/// format (default are the BenchmarkPositions defined above) and the type
-/// of the limit value: depth (default), time in secs or number of nodes.
-/// The analysis is written to a file named bench.txt.
-
-void benchmark(int argc, char* argv[]) {
-
- vector<string> positions;
- string ttSize, threads, valStr, posFile, valType;
- int val, secsPerPos, maxDepth, maxNodes;
-
- ttSize = argc > 2 ? argv[2] : "128";
- threads = argc > 3 ? argv[3] : "1";
- valStr = argc > 4 ? argv[4] : "12";
- posFile = argc > 5 ? argv[5] : "default";
- valType = argc > 6 ? argv[6] : "depth";
-
- Options["Hash"].set_value(ttSize);
- Options["Threads"].set_value(threads);
- Options["OwnBook"].set_value("false");
- Options["Use Search Log"].set_value("true");
- Options["Search Log Filename"].set_value("bench.txt");
-
- secsPerPos = maxDepth = maxNodes = 0;
- val = atoi(valStr.c_str());
-
- if (valType == "depth" || valType == "perft")
- maxDepth = val;
- else if (valType == "time")
- secsPerPos = val * 1000;
+/// be used, the limit value spent for each position (optional, default is
+/// depth 13), an optional file name where to look for positions in FEN
+/// format (defaults are the positions defined above) and the type of the
+/// limit value: depth (default), time in secs or number of nodes.
+
+void benchmark(const Position& current, istream& is) {
+
+ string token;
+ Search::LimitsType limits;
+ vector<string> fens;
+
+ // Assign default values to missing arguments
+ string ttSize = (is >> token) ? token : "32";
+ string threads = (is >> token) ? token : "1";
+ string limit = (is >> token) ? token : "13";
+ string fenFile = (is >> token) ? token : "default";
+ string limitType = (is >> token) ? token : "depth";
+
+ Options["Hash"] = ttSize;
+ Options["Threads"] = threads;
+ TT.clear();
+
+ if (limitType == "time")
+ limits.movetime = 1000 * atoi(limit.c_str()); // movetime is in ms
+
+ else if (limitType == "nodes")
+ limits.nodes = atoi(limit.c_str());
+
+ else if (limitType == "mate")
+ limits.mate = atoi(limit.c_str());
+