2008-08-31 23:59:13 -06:00
|
|
|
/*
|
2008-10-19 10:56:28 -06:00
|
|
|
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
|
|
|
|
Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
|
2010-03-20 04:27:07 -06:00
|
|
|
Copyright (C) 2008-2010 Marco Costalba, Joona Kiiski, Tord Romstad
|
2008-08-31 23:59:13 -06:00
|
|
|
|
2008-10-19 10:56:28 -06:00
|
|
|
Stockfish is free software: you can redistribute it and/or modify
|
2008-08-31 23:59:13 -06:00
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
2009-01-07 06:26:58 -07:00
|
|
|
|
2008-10-19 10:56:28 -06:00
|
|
|
Stockfish is distributed in the hope that it will be useful,
|
2008-08-31 23:59:13 -06:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2009-01-07 06:26:58 -07:00
|
|
|
|
2008-08-31 23:59:13 -06:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <iostream>
|
2009-05-07 04:45:46 -06:00
|
|
|
#include <string>
|
2008-08-31 23:59:13 -06:00
|
|
|
|
2010-11-22 06:55:56 -07:00
|
|
|
#include "bitboard.h"
|
|
|
|
#include "evaluate.h"
|
|
|
|
#include "position.h"
|
|
|
|
#include "thread.h"
|
2011-04-24 02:20:03 -06:00
|
|
|
#include "search.h"
|
2010-11-22 06:55:56 -07:00
|
|
|
#include "ucioption.h"
|
2008-08-31 23:59:13 -06:00
|
|
|
|
2009-05-07 04:45:46 -06:00
|
|
|
using namespace std;
|
|
|
|
|
2011-07-24 00:56:26 -06:00
|
|
|
extern void uci_loop();
|
2010-11-08 12:49:40 -07:00
|
|
|
extern void benchmark(int argc, char* argv[]);
|
2011-06-15 01:09:04 -06:00
|
|
|
extern void kpk_bitbase_init();
|
2008-08-31 23:59:13 -06:00
|
|
|
|
2010-11-08 12:49:40 -07:00
|
|
|
int main(int argc, char* argv[]) {
|
2008-08-31 23:59:13 -06:00
|
|
|
|
2011-12-03 03:43:07 -07:00
|
|
|
bitboards_init();
|
2011-06-13 08:59:03 -06:00
|
|
|
Position::init();
|
2011-06-15 01:09:04 -06:00
|
|
|
kpk_bitbase_init();
|
2011-11-26 04:07:35 -07:00
|
|
|
Search::init();
|
2011-04-24 17:22:48 -06:00
|
|
|
Threads.init();
|
2008-08-31 23:59:13 -06:00
|
|
|
|
2011-02-23 04:23:16 -07:00
|
|
|
if (argc < 2)
|
2010-04-25 03:31:48 -06:00
|
|
|
{
|
2011-04-13 07:12:33 -06:00
|
|
|
cout << engine_name() << " by " << engine_authors() << endl;
|
2010-04-25 03:31:48 -06:00
|
|
|
|
|
|
|
if (CpuHasPOPCNT)
|
|
|
|
cout << "Good! CPU has hardware POPCNT." << endl;
|
|
|
|
|
2011-12-03 02:41:50 -07:00
|
|
|
uci_loop(); // Enter the UCI loop and wait for user input
|
2008-08-31 23:59:13 -06:00
|
|
|
}
|
2011-12-03 02:54:44 -07:00
|
|
|
else if (string(argv[1]) == "bench")
|
2011-02-23 04:23:16 -07:00
|
|
|
benchmark(argc, argv);
|
2011-12-03 02:41:50 -07:00
|
|
|
|
2011-02-23 04:23:16 -07:00
|
|
|
else
|
|
|
|
cout << "Usage: stockfish bench [hash size = 128] [threads = 1] "
|
|
|
|
<< "[limit = 12] [fen positions file = default] "
|
2011-04-25 03:46:52 -06:00
|
|
|
<< "[limited by depth, time, nodes or perft = depth]" << endl;
|
2008-08-31 23:59:13 -06:00
|
|
|
|
2011-04-24 17:22:48 -06:00
|
|
|
Threads.exit();
|
2008-08-31 23:59:13 -06:00
|
|
|
return 0;
|
|
|
|
}
|