mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-27 12:36:15 +08:00
Simplify Book APIs
Retire open(), close() and name() from public visibility and greately simplify the code. It is amazing how much can be squeezed out of an already mature code ! No functional change Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
17
src/book.h
17
src/book.h
@@ -37,25 +37,22 @@ struct BookEntry {
|
||||
uint32_t learn;
|
||||
};
|
||||
|
||||
class Book {
|
||||
|
||||
class Book : private std::ifstream {
|
||||
public:
|
||||
Book();
|
||||
~Book();
|
||||
void open(const std::string& fileName);
|
||||
void close();
|
||||
Move probe(const Position& pos, bool findBestMove);
|
||||
const std::string name() const { return bookName; }
|
||||
Move probe(const Position& pos, const std::string& fName, bool pickBest);
|
||||
|
||||
private:
|
||||
template<typename T> Book& operator>>(T& n);
|
||||
|
||||
BookEntry read_entry(int idx);
|
||||
int first_entry(uint64_t key);
|
||||
bool open(const char* fName);
|
||||
void binary_search(uint64_t key);
|
||||
|
||||
RKISS RKiss;
|
||||
std::ifstream bookFile;
|
||||
std::string bookName;
|
||||
int bookSize;
|
||||
std::string fileName;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
#endif // !defined(BOOK_H_INCLUDED)
|
||||
|
||||
Reference in New Issue
Block a user