Merge branch 'master' of github.com:official-stockfish/Stockfish into nnue-player-merge

This commit is contained in:
nodchip
2020-08-10 08:52:55 +09:00
8 changed files with 35 additions and 117 deletions

View File

@@ -51,9 +51,13 @@ namespace Eval {
std::string eval_file = std::string(Options["EvalFile"]);
if (useNNUE && eval_file_loaded != eval_file)
{
std::cerr << "Use of NNUE evaluation, but the file " << eval_file << " was not loaded successfully. "
<< "These network evaluation parameters must be available, compatible with this version of the code. "
<< "The UCI option EvalFile might need to specify the full path, including the directory/folder name, to the file." << std::endl;
UCI::OptionsMap defaults;
UCI::init(defaults);
std::cerr << "NNUE evaluation used, but the network file " << eval_file << " was not loaded successfully. "
<< "These network evaluation parameters must be available, and compatible with this version of the code. "
<< "The UCI option EvalFile might need to specify the full path, including the directory/folder name, to the file. "
<< "The default net can be downloaded from: https://tests.stockfishchess.org/api/nn/"+std::string(defaults["EvalFile"]) << std::endl;
std::exit(EXIT_FAILURE);
}
@@ -111,7 +115,7 @@ namespace {
constexpr Value LazyThreshold1 = Value(1400);
constexpr Value LazyThreshold2 = Value(1300);
constexpr Value SpaceThreshold = Value(12222);
constexpr Value NNUEThreshold = Value(520);
constexpr Value NNUEThreshold = Value(460);
// KingAttackWeights[PieceType] contains king attack weights by piece type
constexpr int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 81, 52, 44, 10 };
@@ -942,7 +946,7 @@ Value Eval::evaluate(const Position& pos) {
{
Value v = eg_value(pos.psq_score());
// Take NNUE eval only on balanced positions
if (abs(v) < NNUEThreshold)
if (abs(v) < NNUEThreshold + 20 * pos.count<PAWN>())
return NNUE::evaluate(pos) + Tempo;
}
return Evaluation<NO_TRACE>(pos).value();