-void benchmark(const string& commandLine) {
-
- istringstream csVal(commandLine);
- istringstream csStr(commandLine);
- string ttSize, threads, fileName, limitType, timFile;
- int val, secsPerPos, maxDepth, maxNodes;
-
- csStr >> ttSize;
- csVal >> val;
- if (val < 4 || val > 1024)
- {
- cerr << "The hash table size must be between 4 and 1024" << endl;
- Application::exit_with_failure();
- }
- csStr >> threads;
- csVal >> val;
- if (val < 1 || val > MAX_THREADS)
- {
- cerr << "The number of threads must be between 1 and " << MAX_THREADS << endl;
- Application::exit_with_failure();
- }
- set_option_value("Hash", ttSize);
- set_option_value("Threads", threads);
- set_option_value("OwnBook", "false");
- set_option_value("Use Search Log", "true");
- set_option_value("Search Log Filename", "bench.txt");
-
- csVal >> val;
- csVal >> fileName;
- csVal >> limitType;
- csVal >> timFile;
-
- secsPerPos = maxDepth = maxNodes = 0;
-
- if (limitType == "time")
- secsPerPos = val * 1000;
- else if (limitType == "depth" || limitType == "perft")
- maxDepth = val;
+void benchmark(int argc, char* argv[]) {
+
+ vector<string> fenList;
+ SearchLimits limits;
+ int64_t totalNodes;
+ int time;
+
+ // Load default positions
+ for (int i = 0; !Defaults[i].empty(); i++)
+ fenList.push_back(Defaults[i]);
+
+ // Assign default values to missing arguments
+ string ttSize = argc > 2 ? argv[2] : "128";
+ string threads = argc > 3 ? argv[3] : "1";
+ string valStr = argc > 4 ? argv[4] : "12";
+ string fenFile = argc > 5 ? argv[5] : "default";
+ string valType = argc > 6 ? argv[6] : "depth";
+
+ Options["Hash"].set_value(ttSize);
+ Options["Threads"].set_value(threads);
+ Options["OwnBook"].set_value("false");
+
+ // Search should be limited by nodes, time or depth ?
+ if (valType == "nodes")
+ limits.maxNodes = atoi(valStr.c_str());
+ else if (valType == "time")
+ limits.maxTime = 1000 * atoi(valStr.c_str()); // maxTime is in ms