Process 'bench' also from SF prompt

It is possible to start with 'stockfish', then from
command prompt type 'bench' and SF will do what you expect.
Old behaviour is anyhow preserved. As a bonus we can now
start from command line any UCI command understood by
Stockfish. The difference is that after execution of a
command from arguments SF quits, while at the end of the
same command from prompt SF stays in UCI loop.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2012-04-01 09:25:07 +01:00
parent 32c504076f
commit adb71b8096
3 changed files with 38 additions and 31 deletions

View File

@@ -28,15 +28,12 @@
#include "tt.h"
#include "ucioption.h"
using namespace std;
extern void uci_loop();
extern void benchmark(int argc, char* argv[]);
extern void uci_loop(const std::string&);
extern void kpk_bitbase_init();
int main(int argc, char* argv[]) {
cout << engine_info() << endl;
std::cout << engine_info() << std::endl;
bitboards_init();
Position::init();
@@ -46,14 +43,10 @@ int main(int argc, char* argv[]) {
Eval::init();
TT.set_size(Options["Hash"]);
if (argc == 1)
uci_loop();
std::string args;
else if (string(argv[1]) == "bench")
benchmark(argc, argv);
for (int i = 1; i < argc; i++)
args += std::string(" ") + argv[i];
else
cerr << "\nUsage: stockfish bench [hash size = 128] [threads = 1] "
<< "[limit = 12] [fen positions file = default] "
<< "[limited by depth, time, nodes or perft = depth]" << endl;
uci_loop(args);
}