X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmain.cpp;h=62e0ed525d709c0cb3e6a21d44571684e702467a;hb=644f6d47909f3cf2bd3e70485db792789ccad89e;hp=78a91aff4d09e2a97976efca99ee20861b2ec33a;hpb=fad595f5b6b343708fc0b4d8ab15ab73040f84c1;p=stockfish
diff --git a/src/main.cpp b/src/main.cpp
index 78a91aff..62e0ed52 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,7 +1,6 @@
/*
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
- Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
- Copyright (C) 2008-2010 Marco Costalba, Joona Kiiski, Tord Romstad
+ Copyright (C) 2004-2021 The Stockfish developers (see AUTHORS file)
Stockfish is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,73 +16,38 @@
along with this program. If not, see .
*/
-// To profile with callgrind uncomment following line
-//#define USE_CALLGRIND
-
-
-////
-//// Includes
-////
-
#include
-#include
-
-#include "bitcount.h"
-#include "misc.h"
-
-#ifdef USE_CALLGRIND
-#include
-#endif
-
-using namespace std;
-
-extern void uci_main_loop();
-extern void benchmark(const std::string& commandLine);
-
-////
-//// Functions
-////
-
-int main(int argc, char *argv[]) {
-
- // Disable IO buffering
- cout.rdbuf()->pubsetbuf(NULL, 0);
- cin.rdbuf()->pubsetbuf(NULL, 0);
-
- // Initialization through global resources manager
- Application::initialize();
-
-#ifdef USE_CALLGRIND
- CALLGRIND_START_INSTRUMENTATION;
-#endif
-
- if (argc <= 1)
- {
- // Print copyright notice
- cout << engine_name()
- << " by Tord Romstad, Marco Costalba, Joona Kiiski" << endl;
-
- if (CpuHasPOPCNT)
- cout << "Good! CPU has hardware POPCNT." << endl;
-
- // Enter UCI mode
- uci_main_loop();
- }
- else // Process command line arguments
- {
- if (string(argv[1]) != "bench" || argc < 4 || argc > 7)
- cout << "Usage: stockfish bench "
- << "[limit = 12] [fen positions file = default] "
- << "[depth, time, perft or node limited = depth]" << endl;
- else
- {
- string val = argc > 4 ? argv[4] : "12";
- string fen = argc > 5 ? argv[5] : "default";
- string lim = argc > 6 ? argv[6] : "depth";
- benchmark(string(argv[2]) + " " + string(argv[3]) + " " + val + " " + fen + " " + lim);
- }
- }
- Application::free_resources();
+#include "bitboard.h"
+#include "endgame.h"
+#include "position.h"
+#include "psqt.h"
+#include "search.h"
+#include "syzygy/tbprobe.h"
+#include "thread.h"
+#include "tt.h"
+#include "uci.h"
+
+using namespace Stockfish;
+
+int main(int argc, char* argv[]) {
+
+ std::cout << engine_info() << std::endl;
+
+ CommandLine::init(argc, argv);
+ UCI::init(Options);
+ Tune::init();
+ PSQT::init();
+ Bitboards::init();
+ Position::init();
+ Bitbases::init();
+ Endgames::init();
+ Threads.set(size_t(Options["Threads"]));
+ Search::clear(); // After threads are up
+ Eval::NNUE::init();
+
+ UCI::loop(argc, argv);
+
+ Threads.set(0);
return 0;
}