diff --git a/src/bench.cpp b/src/bench.cpp index 53f6f1d..55cfd65 100644 --- a/src/bench.cpp +++ b/src/bench.cpp @@ -48,6 +48,14 @@ Bench::Results Bench::bench(int hashSize, int depth, int cores, bool verbose) // ensure TBs and NNUE are initialized globals::delayedInit(); + if (!globals::nnueInitDone) { + std::cout << "info string ERROR: no network loaded, bench not run" << std::endl; + globals::options.search.hash_table_size = tmp_hash; + globals::options.search.ncpus = tmp_cores; + globals::options.book.book_enabled = tmp_book; + globals::options.book.eco_enabled = tmp_eco; + return Results(); + } SearchController *searcher = new SearchController(); searcher->updateSearchOptions(); diff --git a/src/globals.cpp b/src/globals.cpp index 373bb27..422ff88 100644 --- a/src/globals.cpp +++ b/src/globals.cpp @@ -311,9 +311,15 @@ void globals::delayedInit(bool verbose) { << std::endl; } if (!nnueInitDone) { +#ifdef RAMA_NO_EXIT_WITHOUT_NET + // Rama Chess Android build: no exit, the app sets the net with + // "setoption name NNUE file value "; go answers bestmove 0000 until then + std::cout << "info string ERROR: failed to load network, use setoption name NNUE file value " << std::endl; +#else // This is now a fatal error std::cerr << "failed to load network, terminating." << std::endl; exit(-1); +#endif } } // also initialize the book here diff --git a/src/protocol.cpp b/src/protocol.cpp index d9e852f..f85d11d 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -2256,6 +2256,11 @@ bool Protocol::do_command(const std::string &cmd, Board &board) { // not initialized. Make sure they are before we execute // "go:" globals::delayedInit(); + if (!globals::nnueInitDone) { + std::cout << "info string ERROR: no network loaded, use setoption name NNUE file value " << std::endl; + std::cout << "bestmove 0000" << std::endl; + return true; + } if (do_ponder) { ponder(board,NullMove,NullMove); // We should not send the move unless we have received a