mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 07:27:46 +00:00
Per square stats utility
This commit is contained in:
@@ -11,12 +11,15 @@
|
|||||||
|
|
||||||
#include "nnue/evaluate_nnue.h"
|
#include "nnue/evaluate_nnue.h"
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <sstream>
|
||||||
|
#include <iomanip>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
@@ -74,6 +77,44 @@ namespace Learner::Stats
|
|||||||
std::map<std::string, std::vector<std::unique_ptr<StatisticGathererFactoryBase>>> m_gatherers_by_group;
|
std::map<std::string, std::vector<std::unique_ptr<StatisticGathererFactoryBase>>> m_gatherers_by_group;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Statistic gatherer helpers
|
||||||
|
*/
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct StatPerSquare
|
||||||
|
{
|
||||||
|
StatPerSquare()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < SQUARE_NB; ++i)
|
||||||
|
m_squares[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] T& operator[](Square sq)
|
||||||
|
{
|
||||||
|
return m_squares[sq];
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] const T& operator[](Square sq) const
|
||||||
|
{
|
||||||
|
return m_squares[sq];
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] std::string get_formatted_stats() const
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
for (int i = 0; i < SQUARE_NB; ++i)
|
||||||
|
{
|
||||||
|
ss << std::setw(8) << m_squares[i] << ' ';
|
||||||
|
if ((i + 1) % 8 == 0)
|
||||||
|
ss << '\n';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::array<T, SQUARE_NB> m_squares;
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Definitions for specific statistic gatherers follow:
|
Definitions for specific statistic gatherers follow:
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user