1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 16:53:09 +00:00

[NNUE] remove evalnn command

instead eval uses the evaluation according to the state of Use NNUE

No functional change.
This commit is contained in:
Joost VandeVondele 2020-07-27 20:14:25 +02:00
parent 7182c55e5c
commit 6349062d42
2 changed files with 41 additions and 30 deletions

View file

@ -909,40 +909,53 @@ Value Eval::evaluate(const Position& pos) {
/// trace() is like evaluate(), but instead of returning a value, it returns /// trace() is like evaluate(), but instead of returning a value, it returns
/// a string (suitable for outputting to stdout) that contains the detailed /// a string (suitable for outputting to stdout) that contains the detailed
/// descriptions and values of each evaluation term. Useful for debugging. /// descriptions and values of each evaluation term. Useful for debugging.
/// Trace scores are from white's point of view
std::string Eval::trace(const Position& pos) { std::string Eval::trace(const Position& pos) {
if (pos.checkers()) if (pos.checkers())
return "Total evaluation: none (in check)"; return "Final evaluation: none (in check)";
std::memset(scores, 0, sizeof(scores));
pos.this_thread()->contempt = SCORE_ZERO; // Reset any dynamic contempt
Value v = Evaluation<TRACE>(pos).value();
v = pos.side_to_move() == WHITE ? v : -v; // Trace scores are from white's point of view
std::stringstream ss; std::stringstream ss;
ss << std::showpoint << std::noshowpos << std::fixed << std::setprecision(2) ss << std::showpoint << std::noshowpos << std::fixed << std::setprecision(2);
<< " Term | White | Black | Total \n"
<< " | MG EG | MG EG | MG EG \n" Value v;
<< " ------------+-------------+-------------+------------\n"
<< " Material | " << Term(MATERIAL) if (pos.use_nnue())
<< " Imbalance | " << Term(IMBALANCE) {
<< " Pawns | " << Term(PAWN) v = NNUE::evaluate(pos);
<< " Knights | " << Term(KNIGHT) }
<< " Bishops | " << Term(BISHOP) else
<< " Rooks | " << Term(ROOK) {
<< " Queens | " << Term(QUEEN) std::memset(scores, 0, sizeof(scores));
<< " Mobility | " << Term(MOBILITY)
<< " King safety | " << Term(KING) pos.this_thread()->contempt = SCORE_ZERO; // Reset any dynamic contempt
<< " Threats | " << Term(THREAT)
<< " Passed | " << Term(PASSED) v = Evaluation<TRACE>(pos).value();
<< " Space | " << Term(SPACE)
<< " Winnable | " << Term(WINNABLE) ss << std::showpoint << std::noshowpos << std::fixed << std::setprecision(2)
<< " ------------+-------------+-------------+------------\n" << " Term | White | Black | Total \n"
<< " Total | " << Term(TOTAL); << " | MG EG | MG EG | MG EG \n"
<< " ------------+-------------+-------------+------------\n"
<< " Material | " << Term(MATERIAL)
<< " Imbalance | " << Term(IMBALANCE)
<< " Pawns | " << Term(PAWN)
<< " Knights | " << Term(KNIGHT)
<< " Bishops | " << Term(BISHOP)
<< " Rooks | " << Term(ROOK)
<< " Queens | " << Term(QUEEN)
<< " Mobility | " << Term(MOBILITY)
<< " King safety | " << Term(KING)
<< " Threats | " << Term(THREAT)
<< " Passed | " << Term(PASSED)
<< " Space | " << Term(SPACE)
<< " Winnable | " << Term(WINNABLE)
<< " ------------+-------------+-------------+------------\n"
<< " Total | " << Term(TOTAL);
}
v = pos.side_to_move() == WHITE ? v : -v;
ss << "\nFinal evaluation: " << to_cp(v) << " (white side)\n"; ss << "\nFinal evaluation: " << to_cp(v) << " (white side)\n";

View file

@ -290,8 +290,6 @@ void UCI::loop(int argc, char* argv[]) {
else if (token == "d") sync_cout << pos << sync_endl; else if (token == "d") sync_cout << pos << sync_endl;
else if (token == "eval") sync_cout << Eval::trace(pos) << sync_endl; else if (token == "eval") sync_cout << Eval::trace(pos) << sync_endl;
else if (token == "compiler") sync_cout << compiler_info() << sync_endl; else if (token == "compiler") sync_cout << compiler_info() << sync_endl;
else if (token == "evalnn") sync_cout << "NNUE evaluation: "
<< Eval::NNUE::compute_eval(pos) << sync_endl;
else else
sync_cout << "Unknown command: " << cmd << sync_endl; sync_cout << "Unknown command: " << cmd << sync_endl;