From 433d4115a31ebcf0d9c0e4238b12915b70a0b7c1 Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Fri, 19 Nov 2021 13:13:13 +0100 Subject: [PATCH] Fairy-Stockfish Xiangqi/Janggi NNUE --- src/evaluate.cpp | 12 +++++++++--- src/evaluate.h | 3 ++- src/misc.cpp | 4 ++-- src/ucioption.cpp | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 2b44d3340..89cd37419 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -47,11 +47,16 @@ // Note that this does not work in Microsoft Visual Studio. #if !defined(_MSC_VER) && !defined(NNUE_EMBEDDING_OFF) INCBIN(EmbeddedNNUE, EvalFileDefaultName); + INCBIN(EmbeddedNNUE2, EvalFile2DefaultName); #else const unsigned char gEmbeddedNNUEData[1] = {0x0}; [[maybe_unused]] const unsigned char *const gEmbeddedNNUEEnd = &gEmbeddedNNUEData[1]; const unsigned int gEmbeddedNNUESize = 1; + const unsigned char gEmbeddedNNUE2Data[1] = {0x0}; + [[maybe_unused]] + const unsigned char *const gEmbeddedNNUE2End = &gEmbeddedNNUE2Data[1]; + const unsigned int gEmbeddedNNUE2Size = 1; #endif @@ -120,15 +125,16 @@ namespace Eval { eval_file_loaded = eval_file; } - if (directory == "" && eval_file == EvalFileDefaultName) + if (directory == "" && (eval_file == EvalFileDefaultName || eval_file == EvalFile2DefaultName)) { // C++ way to prepare a buffer for a memory stream class MemoryBuffer : public basic_streambuf { public: MemoryBuffer(char* p, size_t n) { setg(p, p, p + n); setp(p, p + n); } }; - MemoryBuffer buffer(const_cast(reinterpret_cast(gEmbeddedNNUEData)), - size_t(gEmbeddedNNUESize)); + bool first = eval_file == EvalFileDefaultName; + MemoryBuffer buffer(const_cast(reinterpret_cast(first ? gEmbeddedNNUEData : gEmbeddedNNUE2Data)), + size_t(first ? gEmbeddedNNUESize : gEmbeddedNNUE2Size)); istream stream(&buffer); if (load_eval(eval_file, stream)) diff --git a/src/evaluate.h b/src/evaluate.h index 4ee009b4d..47c2f322b 100644 --- a/src/evaluate.h +++ b/src/evaluate.h @@ -41,7 +41,8 @@ namespace Eval { // The default net name MUST follow the format nn-[SHA256 first 12 digits].nnue // for the build process (profile-build and fishtest) to work. Do not change the // name of the macro, as it is used in the Makefile. - #define EvalFileDefaultName "nn-3475407dc199.nnue" + #define EvalFileDefaultName "xiangqi-83f16c17fe26.nnue" + #define EvalFile2DefaultName "janggi-85de3dae670a.nnue" namespace NNUE { diff --git a/src/misc.cpp b/src/misc.cpp index 9075257ca..6a7e5e900 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -67,7 +67,7 @@ namespace { /// Version number. If Version is left empty, then compile date in the format /// DD-MM-YY and show in engine_info. -const string Version = ""; +const string Version = "14.0.1"; /// Our fancy logging facility. The trick here is to replace cin.rdbuf() and /// cout.rdbuf() with two Tie objects that tie cin and cout to a file stream. We @@ -155,7 +155,7 @@ string engine_info(bool to_uci, bool to_xboard) { } #ifdef LARGEBOARDS - ss << " LB"; + ss << " XQ"; #endif if (!to_xboard) diff --git a/src/ucioption.cpp b/src/ucioption.cpp index b1ceb8cdb..0f03f86dd 100644 --- a/src/ucioption.cpp +++ b/src/ucioption.cpp @@ -201,7 +201,7 @@ void init(OptionsMap& o) { o["SyzygyProbeLimit"] << Option(7, 0, 7); o["Use NNUE"] << Option(true, on_use_NNUE); #ifndef NNUE_EMBEDDING_OFF - o["EvalFile"] << Option(EvalFileDefaultName, on_eval_file); + o["EvalFile"] << Option((std::string(EvalFileDefaultName) + UCI::SepChar + EvalFile2DefaultName).c_str(), on_eval_file); #else o["EvalFile"] << Option("", on_eval_file); #endif