- std::cout.rdbuf()->pubsetbuf(NULL, 0);
- std::cin.rdbuf()->pubsetbuf(NULL, 0);
-
- // Initialization
-
- init_mersenne();
- init_direction_table();
- init_bitboards();
- init_uci_options();
- Position::init_zobrist();
- Position::init_piece_square_tables();
- MovePicker::init_phase_table();
- init_eval(1);
- init_bitbases();
- init_threads();
-
- // Make random number generation less deterministic, for book moves
- for (int i = abs(get_system_time() % 10000); i > 0; i--)
- genrand_int32();
-
- // Process command line arguments
- if (argc >= 2 && string(argv[1]) == "bench")
+ cout.rdbuf()->pubsetbuf(NULL, 0);
+ cin.rdbuf()->pubsetbuf(NULL, 0);
+
+ // Initialization through global resources manager
+ Application::initialize();
+
+#ifdef USE_CALLGRIND
+ CALLGRIND_START_INSTRUMENTATION;
+#endif
+
+ // Process command line arguments if any
+ if (argc > 1)