- init_uci_options();
- Position::init_zobrist();
- Position::init_piece_square_tables();
- MaterialInfo::init();
- MovePicker::init_phase_table();
- init_eval(1);
- init_bitbases();
- 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();
-
- // Process command line arguments
- if(argc >= 2) {
- if(std::string(argv[1]) == "bench") {
- if(argc != 4) {
- std::cout << "Usage: glaurung bench <hash> <threads>" << std::endl;
- exit(0);
- }
- benchmark(std::string(argv[2]), std::string(argv[3]));
- return 0;
- }
+ Position::init();
+ kpk_bitbase_init();
+ init_search();
+ Threads.init();
+
+#ifdef USE_CALLGRIND
+ CALLGRIND_START_INSTRUMENTATION;
+#endif
+
+ if (argc < 2)
+ {
+ // Print copyright notice
+ cout << engine_name() << " by " << engine_authors() << endl;
+
+ if (CpuHasPOPCNT)
+ cout << "Good! CPU has hardware POPCNT." << endl;
+
+ // Wait for a command from the user, and passes this command to
+ // execute_uci_command() and also intercepts EOF from stdin to
+ // ensure that we exit gracefully if the GUI dies unexpectedly.
+ string cmd;
+ while (getline(cin, cmd) && execute_uci_command(cmd)) {}