io-chess
UCI chess engine
Loading...
Searching...
No Matches
polyglot_book.hpp
Go to the documentation of this file.
1#pragma once
2
10
11#include "../../../preprocessing/lib/chess/chess.hpp"
12#include <memory>
13#include <string>
14#include <vector>
15
16#pragma pack(push, 1)
22 uint64_t key;
23 uint16_t move;
24 uint16_t weight;
25 uint32_t learn;
26};
27#pragma pack(pop)
28
34public:
40 PolyglotBook(const std::string &book_path);
42
48 bool load();
49
59 chess::Move probe(const chess::Board &board,
60 const std::string &bookName = "Book");
61
62private:
63 std::string book_path_;
64 std::vector<PolyglotEntry> entries_;
65
66 uint64_t compute_polyglot_key(const chess::Board &board) const;
67 chess::Move polyglot_to_move(uint16_t poly_move,
68 const chess::Board &board) const;
69};
bool load()
Loads the book into memory.
Definition polyglot_book.cpp:39
chess::Move polyglot_to_move(uint16_t poly_move, const chess::Board &board) const
Definition polyglot_book.cpp:130
std::string book_path_
Definition polyglot_book.hpp:63
std::vector< PolyglotEntry > entries_
Definition polyglot_book.hpp:64
chess::Move probe(const chess::Board &board, const std::string &bookName="Book")
Probes the book for a move matching the current board state.
Definition polyglot_book.cpp:181
PolyglotBook(const std::string &book_path)
Constructs a PolyglotBook instance.
Definition polyglot_book.cpp:34
~PolyglotBook()
Definition polyglot_book.cpp:37
uint64_t compute_polyglot_key(const chess::Board &board) const
Definition polyglot_book.cpp:67
Represents a single entry in a Polyglot book file.
Definition polyglot_book.hpp:21
uint64_t key
Zobrist hash of the position.
Definition polyglot_book.hpp:22
uint16_t move
Encoded move in Polyglot format.
Definition polyglot_book.hpp:23
uint32_t learn
Learn score (often unused).
Definition polyglot_book.hpp:25
uint16_t weight
Weight or frequency of the move.
Definition polyglot_book.hpp:24