separated printings | bench 6238369

This commit is contained in:
rektdie committed 2025-10-06 17:56:46 +02:00
1 parent 6b5c1bbaa7
commit 5c6d75e9ef
5 files changed
+63 -20

No files matched your search

+19
View File
@@ -80,6 +80,25 @@ public:
}
}
std::string GetMoveString() {
std::string result = squareCoords[MoveFrom()];
result += squareCoords[MoveTo()];
int flags = GetFlags();
if (flags == knightPromotion || flags == knightPromoCapture) {
result += 'n';
} else if (flags == bishopPromotion || flags == bishopPromoCapture) {
result += 'b';
} else if (flags == rookPromotion || flags == rookPromoCapture) {
result += 'r';
} else if (flags == queenPromotion || flags == queenPromoCapture) {
result += 'q';
}
return result;
}
uint16_t ConvertToViriMoveFormat() {
uint16_t viriMove = 0;
int flags = GetFlags();
+29 -20
View File
@@ -6,6 +6,7 @@
#include "benchmark.h"
#include "types.h"
#include "tunables.h"
#include <iomanip>
namespace SEARCH {
@@ -819,26 +820,7 @@ static SearchResults ID(Board &board, SearchParams params, SearchContext* ctx) {
}
if constexpr (mode == normal || mode == nodesMode) {
std::cout << "info ";
std::cout << "depth " << depth;
std::cout << " seldepth " << ctx->seldepth;
std::cout << " time " << elapsed;
std::cout << " score ";
if (std::abs(safeResults.score) + MAX_PLY >= MATE_SCORE) {
int mateIn = (MATE_SCORE - (std::abs(safeResults.score) - 1)) / 2;
mateIn = safeResults.score < 0 ? mateIn * -1 : mateIn;
std::cout << "mate " << mateIn;
} else {
std::cout << "cp " << safeResults.score;
}
std::cout << " nodes " << ctx->nodes << " nps " << int(ctx->nodes/ctx->sw.GetElapsedSec());
std::cout << " hashfull " << ctx->TT.GetUsedPercentage();
std::cout << " pv ";
ctx->pvLine.Print(0);
std::cout << std::endl;
PrintSearchInfo(ctx, safeResults, depth, elapsed);
if constexpr (mode == normal) {
if (ctx->sw.GetElapsedMS() >= softTime) {
@@ -905,6 +887,33 @@ int MoveEstimatedValue(Board& board, Move& move) {
return value;
}
void PrintSearchInfo(SearchContext* ctx, SearchResults& results, int depth, int elapsed) {
if (UCIEnabled) {
std::cout << "info ";
std::cout << "depth " << depth;
std::cout << " seldepth " << ctx->seldepth;
std::cout << " time " << elapsed;
std::cout << " score ";
if (std::abs(results.score) + MAX_PLY >= MATE_SCORE) {
int mateIn = (MATE_SCORE - (std::abs(results.score) - 1)) / 2;
mateIn = results.score < 0 ? mateIn * -1 : mateIn;
std::cout << "mate " << mateIn;
} else {
std::cout << "cp " << results.score;
}
std::cout << " nodes " << ctx->nodes << " nps " << int(ctx->nodes/ctx->sw.GetElapsedSec());
std::cout << " hashfull " << ctx->TT.GetUsedPercentage();
std::cout << " pv ";
ctx->pvLine.Print(0);
std::cout << std::endl;
} else {
// TODO
}
}
template SearchResults PVS<true, searchMode::bench>(Board&, int, int, int, int, SearchContext* ctx, bool cutnode);
template SearchResults PVS<false, searchMode::bench>(Board&, int, int, int, int, SearchContext* ctx, bool cutnode);
template SearchResults PVS<true, searchMode::normal>(Board&, int, int, int, int, SearchContext* ctx, bool cutnode);
+12
View File
@@ -148,6 +148,16 @@ public:
}
}
std::string GetLine(int n) {
std::string result = "";
for (int i = 0; i < length[n]; i++) {
result += table[n][i].GetMoveString();
result += ' ';
}
return result;
}
void Clear() {
length[MAX_DEPTH - 1] = {};
table[MAX_DEPTH - 1][MAX_DEPTH - 1] = {};
@@ -218,5 +228,7 @@ bool IsDraw(Board &board, SearchContext* ctx);
void ListScores(Board &board, SearchContext* ctx);
void PrintSearchInfo(SearchContext* ctx, SearchResults& results, int depth, int elapsed);
int MoveEstimatedValue(Board& board, Move& move);
}
+1
View File
@@ -278,6 +278,7 @@ void UCILoop(Board &board) {
// parse UCI "uci" command
if (input.find("uci") != std::string::npos) {
UCIEnabled = true;
// print engine info
PrintEngineInfo();
continue;
+2
View File
@@ -2,6 +2,8 @@
#include "move.h"
#include "board.h"
inline bool UCIEnabled = false;
class SearchParams {
public:
int wtime = 0;