Skip to content

Commit

Permalink
refactor: formatting for missing uci default values (Disservin#507)
Browse files Browse the repository at this point in the history
  • Loading branch information
gahtan-syarif committed Jun 27, 2024
1 parent 5c39263 commit d76ae56
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions app/src/matchmaking/output/output_fastchess.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ class Fastchess : public IOutput {

auto threadsFirst = getThreads(engines.first);
auto threadsSecond = getThreads(engines.second);
auto threads = threadsFirst == threadsSecond ? fmt::format("{}t", threadsFirst)
: fmt::format("{}t - {}t", threadsFirst, threadsSecond);
auto threads = threadsFirst == threadsSecond ? fmt::format("{}", threadsFirst)
: fmt::format("{} - {}", threadsFirst, threadsSecond);

auto hashFirst = getHash(engines.first);
auto hashSecond = getHash(engines.second);

auto hash = hashFirst == hashSecond ? fmt::format("{}MB", hashFirst)
: fmt::format("{}MB - {}MB", hashFirst, hashSecond);
auto hash = hashFirst == hashSecond ? fmt::format("{}", hashFirst)
: fmt::format("{} - {}", hashFirst, hashSecond);

const auto games = stats.wins + stats.losses + stats.draws;
const auto points = stats.wins + 0.5 * stats.draws;
Expand Down Expand Up @@ -136,11 +136,13 @@ class Fastchess : public IOutput {
}

std::string getThreads(const engine::UciEngine& engine) {
return fmt::format("{}", engine.getUciOptionValue("Threads").value_or("1"));
return fmt::format("{}{}", engine.getUciOptionValue("Threads").value_or("NULL"),
engine.getUciOptionValue("Threads").has_value() ? "t" : "");
}

std::string getHash(const engine::UciEngine& engine) {
return fmt::format("{}", engine.getUciOptionValue("Hash").value_or(""));
return fmt::format("{}{}", engine.getUciOptionValue("Hash").value_or("NULL"),
engine.getUciOptionValue("Hash").has_value() ? "MB" : "");
}

bool report_penta_;
Expand Down

0 comments on commit d76ae56

Please sign in to comment.