mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Extend bench to static evaluations
this patch extends bench to print static evaluations. ./stockfish bench 16 1 1 filename eval will now print the evaluations for all fens in the file. This complements the various 'go' flavors for bench and might be useful for debugging and/or tuning. No functional change.
This commit is contained in:
parent
df340a839c
commit
54253bcce6
3 changed files with 14 additions and 6 deletions
|
@ -117,7 +117,7 @@ vector<string> setup_bench(const Position& current, istream& is) {
|
||||||
string fenFile = (is >> token) ? token : "default";
|
string fenFile = (is >> token) ? token : "default";
|
||||||
string limitType = (is >> token) ? token : "depth";
|
string limitType = (is >> token) ? token : "depth";
|
||||||
|
|
||||||
go = "go " + limitType + " " + limit;
|
go = limitType == "eval" ? "eval" : "go " + limitType + " " + limit;
|
||||||
|
|
||||||
if (fenFile == "default")
|
if (fenFile == "default")
|
||||||
fens = Defaults;
|
fens = Defaults;
|
||||||
|
|
|
@ -847,6 +847,9 @@ Value Eval::evaluate(const Position& pos) {
|
||||||
|
|
||||||
std::string Eval::trace(const Position& pos) {
|
std::string Eval::trace(const Position& pos) {
|
||||||
|
|
||||||
|
if (pos.checkers())
|
||||||
|
return "Total evaluation: none (in check)";
|
||||||
|
|
||||||
std::memset(scores, 0, sizeof(scores));
|
std::memset(scores, 0, sizeof(scores));
|
||||||
|
|
||||||
pos.this_thread()->contempt = SCORE_ZERO; // Reset any dynamic contempt
|
pos.this_thread()->contempt = SCORE_ZERO; // Reset any dynamic contempt
|
||||||
|
|
|
@ -146,7 +146,7 @@ namespace {
|
||||||
uint64_t num, nodes = 0, cnt = 1;
|
uint64_t num, nodes = 0, cnt = 1;
|
||||||
|
|
||||||
vector<string> list = setup_bench(pos, args);
|
vector<string> list = setup_bench(pos, args);
|
||||||
num = count_if(list.begin(), list.end(), [](string s) { return s.find("go ") == 0; });
|
num = count_if(list.begin(), list.end(), [](string s) { return s.find("go ") == 0 || s.find("eval") == 0; });
|
||||||
|
|
||||||
TimePoint elapsed = now();
|
TimePoint elapsed = now();
|
||||||
|
|
||||||
|
@ -155,13 +155,18 @@ namespace {
|
||||||
istringstream is(cmd);
|
istringstream is(cmd);
|
||||||
is >> skipws >> token;
|
is >> skipws >> token;
|
||||||
|
|
||||||
if (token == "go")
|
if (token == "go" || token == "eval")
|
||||||
{
|
{
|
||||||
cerr << "\nPosition: " << cnt++ << '/' << num << endl;
|
cerr << "\nPosition: " << cnt++ << '/' << num << endl;
|
||||||
|
if (token == "go")
|
||||||
|
{
|
||||||
go(pos, is, states);
|
go(pos, is, states);
|
||||||
Threads.main()->wait_for_search_finished();
|
Threads.main()->wait_for_search_finished();
|
||||||
nodes += Threads.nodes_searched();
|
nodes += Threads.nodes_searched();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
sync_cout << "\n" << Eval::trace(pos) << sync_endl;
|
||||||
|
}
|
||||||
else if (token == "setoption") setoption(is);
|
else if (token == "setoption") setoption(is);
|
||||||
else if (token == "position") position(pos, is, states);
|
else if (token == "position") position(pos, is, states);
|
||||||
else if (token == "ucinewgame") { Search::clear(); elapsed = now(); } // Search::clear() may take some while
|
else if (token == "ucinewgame") { Search::clear(); elapsed = now(); } // Search::clear() may take some while
|
||||||
|
|
Loading…
Add table
Reference in a new issue