From 3b11b9d4f3eee5faa656d7ee61077e80726bdc36 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Mon, 16 Jan 2023 14:55:48 +0100 Subject: Improve openings database code --- src/Openings.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/Openings.hpp (limited to 'src/Openings.hpp') 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 MoveList; + typedef std::vector> 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 -- cgit v1.2.3