X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmain.cpp;h=e89fee0ed80e0bc2ea49a6789fd79689111b8a1e;hp=49c66c0da69384e761034607a9548936a9ae9fe7;hb=2dbc8feae32e923904a9d05ced4847fd8e6f6724;hpb=bb751d6c890f5c50c642366d601740366cfae8d0 diff --git a/src/main.cpp b/src/main.cpp index 49c66c0d..e89fee0e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,7 +21,6 @@ //// Includes //// -#include #include #include "benchmark.h" @@ -39,6 +38,7 @@ #include "uci.h" #include "ucioption.h" +using std::string; //// //// Functions @@ -47,8 +47,6 @@ int main(int argc, char *argv[]) { // Disable IO buffering - setbuf(stdin, NULL); - setbuf(stdout, NULL); std::cout.rdbuf()->pubsetbuf(NULL, 0); std::cin.rdbuf()->pubsetbuf(NULL, 0); @@ -67,20 +65,23 @@ int main(int argc, char *argv[]) { init_threads(); // Make random number generation less deterministic, for book moves - int i = abs(get_system_time() % 10000); - for(int j = 0; j < i; j++) - genrand_int32(); + for (int i = abs(get_system_time() % 10000); i > 0; i--) + genrand_int32(); // Process command line arguments - if(argc >= 2) { - if(std::string(argv[1]) == "bench") { - if(argc != 4) { - std::cout << "Usage: glaurung bench " << std::endl; + if (argc >= 2 && string(argv[1]) == "bench") + { + if (argc < 4 || argc > 6) + { + std::cout << "Usage: glaurung bench " + << "[time = 60s] [fen positions file = default]" + << std::endl; exit(0); } - benchmark(std::string(argv[2]), std::string(argv[3])); + string time = argc > 4 ? argv[4] : "60"; + string fen = argc > 5 ? argv[5] : "default"; + benchmark(string(argv[2]) + " " + string(argv[3]) + " " + time + " " + fen); return 0; - } } // Print copyright notice