File tree Expand file tree Collapse file tree 3 files changed +9
-12
lines changed
Expand file tree Collapse file tree 3 files changed +9
-12
lines changed Original file line number Diff line number Diff line change 1818*/
1919
2020#include < iostream>
21- #include < string>
2221
2322#include " bitboard.h"
2423#include " evaluate.h"
@@ -42,12 +41,7 @@ int main(int argc, char* argv[]) {
4241 Threads.init ();
4342 TT.resize (Options[" Hash" ]);
4443
45- std::string args;
46-
47- for (int i = 1 ; i < argc; ++i)
48- args += std::string (argv[i]) + " " ;
49-
50- UCI::loop (args);
44+ UCI::loop (argc, argv);
5145
5246 Threads.exit ();
5347}
Original file line number Diff line number Diff line change @@ -143,13 +143,16 @@ namespace {
143143// / that we exit gracefully if the GUI dies unexpectedly. In addition to the UCI
144144// / commands, the function also supports a few debug commands.
145145
146- void UCI::loop (const string& args ) {
146+ void UCI::loop (int argc, char * argv[] ) {
147147
148148 Position pos (StartFEN, false , Threads.main ()); // The root position
149- string token, cmd = args;
149+ string token, cmd;
150+
151+ for (int i = 1 ; i < argc; ++i)
152+ cmd += std::string (argv[i]) + " " ;
150153
151154 do {
152- if (args. empty () && !getline (cin, cmd)) // Block here waiting for input
155+ if (argc == 1 && !getline (cin, cmd)) // Block here waiting for input
153156 cmd = " quit" ;
154157
155158 istringstream is (cmd);
@@ -208,7 +211,7 @@ void UCI::loop(const string& args) {
208211 else
209212 sync_cout << " Unknown command: " << cmd << sync_endl;
210213
211- } while (token != " quit" && args. empty ()) ; // Args have one-shot behaviour
214+ } while (token != " quit" && argc == 1 ) ; // Passed args have one-shot behaviour
212215
213216 Threads.wait_for_think_finished (); // Cannot quit whilst the search is running
214217}
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ class Option {
6161};
6262
6363void init (OptionsMap&);
64- void loop (const std::string& );
64+ void loop (int argc, char * argv[] );
6565
6666} // namespace UCI
6767
You can’t perform that action at this time.
0 commit comments