]> git.sesse.net Git - stockfish/blobdiff - src/book.h
Simplify Book APIs
[stockfish] / src / book.h
index 947e323ab26820abff41cc266ddc781e71c344f2..24fa9f2daf45b2e1c087bf644ecf053f1cdcf449 100644 (file)
@@ -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)