BenBot 1.7.5
A chess engine
Loading...
Searching...
No Matches
EPD.hpp
Go to the documentation of this file.
1/*
2 * ======================================================================================
3 *
4 * ░▒▓███████▓▒░░▒▓████████▓▒░▒▓███████▓▒░ ░▒▓███████▓▒░ ░▒▓██████▓▒░▒▓████████▓▒░
5 * ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░
6 * ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░
7 * ░▒▓███████▓▒░░▒▓██████▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓███████▓▒░░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░
8 * ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░
9 * ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░
10 * ░▒▓███████▓▒░░▒▓████████▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓███████▓▒░ ░▒▓██████▓▒░ ░▒▓█▓▒░
11 *
12 * ======================================================================================
13 */
14
19
20#pragma once
21
22#include <expected>
24#include <string>
25#include <string_view>
26#include <unordered_map>
27#include <vector>
28
29namespace chess::notation {
30
31using game::Position;
32using std::string;
33using std::string_view;
34
39struct [[nodiscard]] EPDPosition final {
42
47 std::unordered_map<string, string> operations;
48
52 [[nodiscard]] auto operator==(const EPDPosition& other) const noexcept -> bool = default;
53
58};
59
68[[nodiscard]] auto from_epd(
69 string_view epdString)
70 -> std::expected<EPDPosition, string>;
71
78[[nodiscard]] auto parse_all_epds(
79 string_view fileContent)
80 -> std::vector<EPDPosition>;
81
87[[nodiscard]] auto to_epd(
88 const EPDPosition& pos) -> string;
89
96namespace epd_ops {
98 inline constexpr string_view AnalysisCountDepth { "acd" };
99 // codespell:ignore acn
101 inline constexpr string_view AnalysisCountNodes { "acn" }; // codespell:ignore acn
102
104 inline constexpr string_view AnalysisCountSeconds { "acs" };
105
107 inline constexpr string_view AvoidMove { "am" };
108
110 inline constexpr string_view BestMove { "bm" };
111
115 inline constexpr string_view Comment { "c0" };
116
118 inline constexpr string_view CentipawnEvaluation { "ce" };
119
121 inline constexpr string_view DirectMate { "dm" };
122
124 inline constexpr string_view DrawAccept { "draw_accept" };
125
127 inline constexpr string_view DrawClaim { "draw_claim" };
128
130 inline constexpr string_view DrawOffer { "draw_offer" };
131
133 inline constexpr string_view DrawReject { "draw_reject" };
134
136 inline constexpr string_view EcoCode { "eco" };
137
139 inline constexpr string_view FullmoveNumber { "fmvn" };
140
142 inline constexpr string_view HalfmoveClock { "hmvc" };
143
145 inline constexpr string_view PositionID { "id" };
146
148 inline constexpr string_view NicCode { "nic" };
149
151 inline constexpr string_view NoOp { "noop" };
152
154 inline constexpr string_view PredictedMove { "pm" };
155
157 inline constexpr string_view PredictedVariation { "pv" };
158
160 inline constexpr string_view RepetitionCount { "rc" };
161
163 inline constexpr string_view Resignation { "resign" };
164
166 inline constexpr string_view SuppliedMove { "sm" };
167} // namespace epd_ops
168
169} // namespace chess::notation
auto from_epd(string_view epdString) -> std::expected< EPDPosition, string >
auto to_epd(const EPDPosition &pos) -> string
auto parse_all_epds(string_view fileContent) -> std::vector< EPDPosition >
constexpr string_view DrawOffer
Definition EPD.hpp:130
constexpr string_view EcoCode
Definition EPD.hpp:136
constexpr string_view HalfmoveClock
Definition EPD.hpp:142
constexpr string_view PositionID
Definition EPD.hpp:145
constexpr string_view BestMove
Definition EPD.hpp:110
constexpr string_view FullmoveNumber
Definition EPD.hpp:139
constexpr string_view DirectMate
Definition EPD.hpp:121
constexpr string_view AvoidMove
Definition EPD.hpp:107
constexpr string_view CentipawnEvaluation
Definition EPD.hpp:118
constexpr string_view SuppliedMove
Definition EPD.hpp:166
constexpr string_view Comment
Definition EPD.hpp:115
constexpr string_view Resignation
Definition EPD.hpp:163
constexpr string_view PredictedVariation
Definition EPD.hpp:157
constexpr string_view AnalysisCountDepth
Definition EPD.hpp:98
constexpr string_view PredictedMove
Definition EPD.hpp:154
constexpr string_view AnalysisCountSeconds
Definition EPD.hpp:104
constexpr string_view DrawReject
Definition EPD.hpp:133
constexpr string_view DrawAccept
Definition EPD.hpp:124
constexpr string_view AnalysisCountNodes
Definition EPD.hpp:101
constexpr string_view RepetitionCount
Definition EPD.hpp:160
constexpr string_view DrawClaim
Definition EPD.hpp:127
constexpr string_view NoOp
Definition EPD.hpp:151
constexpr string_view NicCode
Definition EPD.hpp:148
std::unordered_map< string, string > operations
Definition EPD.hpp:47
auto operator==(const EPDPosition &other) const noexcept -> bool=default