aboutsummaryrefslogtreecommitdiff
path: root/src/Openings.hpp
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-01-16 14:55:48 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2023-01-16 14:55:48 +0100
commit3b11b9d4f3eee5faa656d7ee61077e80726bdc36 (patch)
tree7817c036843c18eac0012298ec7808d795411f58 /src/Openings.hpp
parentb7667d1d40045ecd840b9b192c2740e5f83e7eba (diff)
Improve openings database code
Diffstat (limited to 'src/Openings.hpp')
-rw-r--r--src/Openings.hpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Openings.hpp b/src/Openings.hpp
new file mode 100644
index 0000000..adf05c1
--- /dev/null
+++ b/src/Openings.hpp
@@ -0,0 +1,21 @@
+#pragma once
+
+#include "binres/openings.hpp"
+#include "pgnp.hpp"
+
+/**
+ * @brief Guess the opening using the Lichess Opening Database
+ * See: https://github.com/lichess-org/chess-openings
+ */
+class Openings {
+ typedef std::vector<std::string> MoveList;
+ typedef std::vector<std::tuple<std::string,std::string,std::string>> Volume;
+
+ Volume A,B,C,D,E;
+ void SearchOpening(const pgnp::HalfMove *moves,std::string &name, std::string &eco);
+ void LoadVolume(const std::string &tsv, Volume *vol);
+public:
+ void GuessOpening(const std::string &SANMoves, std::string &name, std::string &eco);
+ void GuessOpening(const pgnp::HalfMove *moves, std::string &name, std::string &eco);
+ Openings();
+}; \ No newline at end of file