Datagen #46

Merged
rektdie merged 27 commits from datagen into main 2025-04-03 03:54:14 +02:00
Showing only changes of commit 8287ac739a - Show all commits
+8 -2
View File
@@ -150,7 +150,7 @@ static void WriteToFile(const Game &game, const std::string &filename) {
file.close();
}
void PrintProgress(int positions, int targetPositions, Stopwatch &stopwatch) {
void PrintProgress(int positions, int targetPositions, Stopwatch &stopwatch, int threads) {
double elapsed = stopwatch.GetElapsedSec();
double positionsPerSec = elapsed > 0 ? positions / elapsed : 0;
@@ -190,6 +190,12 @@ void PrintProgress(int positions, int targetPositions, Stopwatch &stopwatch) {
std::cout << std::endl;
std::string threadsText = "Threads: " + std::to_string(static_cast<int>(threads));
int threadsTextPadding = (width - threadsText.length()) / 2;
std::cout << std::setw(threadsTextPadding + threadsText.length()) << threadsText << std::endl;
std::cout << std::endl;
int barWidth = 50;
double progress = (double)positions / targetPositions;
int pos = (int)(progress * barWidth);
@@ -268,7 +274,7 @@ void Run(int targetPositions, int threads) {
if (positions / 100 > lastPrintedPosition) {
lastPrintedPosition = positions / 1000;
PrintProgress(positions, targetPositions * 1000000, stopwatch);
PrintProgress(positions, targetPositions * 1000000, stopwatch, threads);
}
}