11 #pragma GCC diagnostic push
12 #pragma GCC diagnostic ignored "-Weffc++"
24 #pragma GCC diagnostic pop
27 bEpd::operator std::string()
const
30 ss << m_Fen <<
" => ";
31 for (
const auto &m : m_Keys)
32 ss <<
"[" << m.first <<
"] = " << m.second <<
"; ";
45 for (
int i = 1; i <= 99; i++) {
47 if (m_Keys.find(sOp) != m_Keys.end()) { bPerft =
true;
break; }
65 if (sFenSgmt.size() > 4) {
67 m_Fen = sFenSgmt[0] +
" " + sFenSgmt[1] +
" "
68 + sFenSgmt[2] +
" " + sFenSgmt[3];
69 sFenSgmt.erase(sFenSgmt.begin(), sFenSgmt.begin() + 4);
73 m_Fen +=
" " + sFenSgmt[0];
74 sFenSgmt.erase(sFenSgmt.begin());
81 m_Fen +=
" " + sFenSgmt[0];
82 sFenSgmt.erase(sFenSgmt.begin());
88 std::string sCmd =
";" + std::accumulate(sFenSgmt.begin(), sFenSgmt.end(), std::string(),
89 [](std::string result, std::string sElem) {
90 return std::move(result) + std::move(sElem) +
" ";
95 for (
auto it = sCmdSgmt.begin(); it != sCmdSgmt.end(); ++it) {
102 for (
const auto &sElem : sCmdSgmt) {
103 if (sElem.length() > 0) {
105 if (sElem.substr(0,3) ==
"id=") {
130 std::string s = std::accumulate(sParams.begin(), sParams.end(), std::string(),
131 [](std::string result, std::string sElem) {
132 return std::move(result) + std::move(sElem) +
" ";
143 #if defined(__GNUC__)
144 #pragma GCC diagnostic push
145 #pragma GCC diagnostic ignored "-Weffc++"
150 attachFile(sFileName);
155 attachFile(sParams[0]);
158 #if defined(__GNUC__)
159 #pragma GCC diagnostic pop
164 if (m_sEpdFile.is_open()) m_sEpdFile.close();
167 void bEpdFile::attachFile(std::string
const& sFileName)
169 m_sEpdFile.open(sFileName.c_str(), std::ios::in );
170 if (!m_sEpdFile.is_open()) {
185 if (!m_sEpdFile.is_open())
return bEpd::tReturn::EPD_ERROR;
187 while(getline(m_sEpdFile,line)) {
188 if (line.length() < 6) {
190 }
else if ((line.substr(0,1) ==
";")
191 || (line.substr(0,1) ==
"#")) {
197 if (result == bEpd::tReturn::EPD_ERROR) {
198 App().
bout <<
"Error : " << std::string(*
this);
199 return bEpd::tReturn::EPD_ERROR;
200 }
else if (result >= bEpd::tReturn::PERFT_OK) {
201 App().
bout <<
"Perft OK : " << std::string(*
this);
202 nGoods += bEpd::tReturn::BM_OK;
203 }
else if (result == bEpd::tReturn::EPD_OK) {
205 }
else if (result > bEpd::tReturn::BM_OK) {
207 nGoods += bEpd::tReturn::BM_OK;
208 }
else if (result > bEpd::tReturn::EPD_OK) {
211 }
else if (result == bEpd::tReturn::NOT_RESOLVED) {
212 App().
bout <<
"Not resolved : " << std::string(*
this);
213 }
else if (result == bEpd::tReturn::NO_MOVE_FOUND) {
214 App().
bout <<
"No move found : " << std::string(*
this);
216 nTotal += bEpd::tReturn::BM_OK;
223 App().
bout <<
"Result " << nGoods <<
"/" << nTotal;
225 App().
bout <<
"Result " << nGoods / bEpd::tReturn::BM_OK
226 <<
"/" << nTotal / bEpd::tReturn::BM_OK;
228 if (nTotal > 0)
App().
bout <<
" =" << (nGoods * 100) / nTotal <<
"%\n";
231 return bEpd::tReturn::EPD_OK;
engineInterface * AppEI()
This is the main include file, needs to be included before any other include.
virtual ~bEpdFile() override
bEpdFile(std::string const &sFileName)
virtual bEpdResult parse(epdTest_t const typeOfTest) override
Main epd parser for multiple line epd file Will calculate a total score and some statistics.
void setPos(std::string const &pos)
set EPD position composed of (simplified) FEN and EPD opcodes
virtual bEpdResult parse(epdTest_t const typeOfTest)
bEpdPos(std::string const &fen)
virtual ~bEpdPos() override
bEpdResult evalPerftResult(bFen const &fen, bEpdOpCodes &opcodes)
check perft result for different depths D[1-99] # perft test - nodes
bEpdResult evalEpdPosition(bFen const &fen, bEpdOpCodes &opcodes, epdTest_t const typeOfTest)
do actual epd position test change level if any of following set acs # set search seconds dm # set di...
virtual void sendDebug(int const l, std::string const &info)
virtual void sendError(std::string const &error, std::string const &description)
std::vector< std::string > bEpdParamList
enum tEpdTestType epdTest_t
std::string alltrim(std::string s, std::string const &delim=" ")
trim left and right spaces or delim from string
std::pair< std::string, std::string > decompose(std::string const &src, std::string const &delim)
Split delimited long string into a pair based on delimiter e.g.
std::vector< std::string > stringList
bool is_number(std::string const &s)
std::string to_string(long value)
std::to_string not compatible on Mac OS (Apple LLVM version 5.0) provide generic utility function
stringList stringSplit(std::string src, std::string delim)
Split delimited long string into a vector.