Belofte version 2.1.9
A promising chess program using the UCI or Winboard interface
epd_testsuite.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------+
2 * File: epd_testsuite.h
3 * Project: part of belofte - A Promising Chess Program
4 * Author: yves
5 * SPDX-License-Identifier: GPL-2.0-only
6+----------------------------------------------------------------------*/
7
8#if !defined(EPD_TESTSUITE_H)
9#define EPD_TESTSUITE_H
10
11#define EPD_PERFTMAXDEPTH 32
12
13typedef std::vector<std::string> bEpdParamList;
14typedef int bEpdResult; /// @todo change to enum
15typedef std::map<std::string, std::string> bEpdOpCodes;
16typedef std::map<std::string, int> bEpdMoveValues;
17
23
25
26//-----------------------------------------------------------------------
27
28#if defined(__GNUC__)
29#pragma GCC diagnostic push
30#pragma GCC diagnostic ignored "-Weffc++"
31#endif
32
33class bEpd {
34public:
35 explicit bEpd(epdTest_t const typeOfTest)
36 : m_typeOfTest{typeOfTest}
37 {}
38 virtual ~bEpd()
39 {}
40
41 // no copy or move ctor nor assignment defined
42 bEpd(bEpd const&) = delete;
43 bEpd(bEpd&&) = delete;
44 bEpd& operator=(bEpd const&) = delete;
45 bEpd& operator=(bEpd&&) = delete;
46
47 virtual bEpdResult parse();
48
49 operator std::string() const;
50
51protected:
52 void setPos(std::string const& s);
53 int getScore() const { return m_actualScore; }
54 void setScore(int const s) { m_actualScore = s; }
55 epdTest_t getTestType() const { return m_typeOfTest; }
56
60
62 int translateSTSResult(bPgnMove const& m, bEpdMoveValues& moveValues);
63
64 std::string const getTag(std::string const& tag);
65
66private:
67 bool m_valid = false;
68 std::string m_Pos;
69 std::string m_Fen;
70 bEpdOpCodes m_Keys;
71 epdTest_t m_typeOfTest;
72 int m_actualScore = 0;
73
74public:
75 enum tReturn {
80 EPD_OK = 0,
81 STS_OK = 1,
82 BM_OK = 10,
83 AM_OK = 11,
84 MATE_OK = 12,
86 };
87};
88
89#if defined(__GNUC__)
90#pragma GCC diagnostic pop
91#endif
92
93class bEpdPos : public bEpd {
94public:
95 explicit bEpdPos(std::string const& sEpd, epdTest_t const typeOfTest);
96 explicit bEpdPos(bEpdParamList const& sParams, epdTest_t const typeOfTest);
97 virtual ~bEpdPos() override
98 {}
99
100 // no copy or move ctor nor assignment defined
101 bEpdPos(bEpdPos const&) = delete;
102 bEpdPos(bEpdPos&&) = delete;
103 bEpdPos& operator=(bEpdPos const&) = delete;
105};
106
107class bEpdFile : public bEpd {
108public:
109 explicit bEpdFile(std::string const& sFileName, epdTest_t const typeOfTest);
110 explicit bEpdFile(bEpdParamList const& sParams, epdTest_t const typeOfTest);
111 virtual ~bEpdFile() override;
112
113 // no copy or move ctor nor assignment defined
114 bEpdFile(bEpdFile const&) = delete;
115 bEpdFile(bEpdFile&&) = delete;
116 bEpdFile& operator=(bEpdFile const&) = delete;
118
119 virtual bEpdResult parse() override;
120
121private:
122 void handleFile(std::string const& sFileName);
123
124 std::ifstream m_sEpdFile;
125};
126
127#endif // defined EPD_TESTSUITE_H
128
129// eof
130
bEpdFile(std::string const &sFileName, epdTest_t const typeOfTest)
virtual ~bEpdFile() override
bEpdFile(bEpdFile const &)=delete
virtual bEpdResult parse() override
Main epd parser for multiple lines of epd file Will calculate a total score and some statistics.
bEpdFile & operator=(bEpdFile const &)=delete
bEpdFile(bEpdFile &&)=delete
bEpdFile & operator=(bEpdFile &&)=delete
virtual ~bEpd()
int translateSTSResult(bPgnMove const &m, bEpdMoveValues &moveValues)
std::string const getTag(std::string const &tag)
bEpd(bEpd &&)=delete
virtual bEpdResult parse()
parse any epd position
bEpdResult parseEpdPosition(bFen const &fen)
do actual epd position test
bEpd & operator=(bEpd &&)=delete
bEpdResult parseSTSPosition(bFen const &fen)
bEpdResult translateEpdResult(bPgnMove const &m)
check move found against epd line m_Keys, change level before starting search am avoid-moves bm best-...
void setPos(std::string const &s)
EPD pos is fen-board fen-tomove fen-castling fen-ep [50moves] [move#] cmdsection* cmdsection is bm Sa...
bEpd(epdTest_t const typeOfTest)
bEpdResult parsePerftPosition(bFen const &fen)
check perft result for different depths D[1-99] # perft test - nodes
epdTest_t getTestType() const
bEpd & operator=(bEpd const &)=delete
int getScore() const
void setScore(int const s)
@ NO_MOVE_FOUND
@ NOT_RESOLVED
@ EPD_ERROR
@ PERFT_MISS
bEpd(bEpd const &)=delete
bEpdPos(bEpdPos &&)=delete
virtual ~bEpdPos() override
bEpdPos(bEpdPos const &)=delete
bEpdPos(std::string const &sEpd, epdTest_t const typeOfTest)
bEpdPos & operator=(bEpdPos &&)=delete
bEpdPos & operator=(bEpdPos const &)=delete
FEN string.
Definition fen.h:14
PgnMove is for user-interface only.
Definition pgnmove.h:14
std::vector< std::string > bEpdParamList
enum tEpdTestType epdTest_t
tEpdTestType
@ EPD_STS
@ EPD_GENERIC
@ EPD_PERF
std::map< std::string, int > bEpdMoveValues
int bEpdResult
std::map< std::string, std::string > bEpdOpCodes