From a72b1c28ccf48fbdd9c9c25fcc0e4da6405c4a8b Mon Sep 17 00:00:00 2001 From: Steven Elliott Date: Thu, 17 Dec 2020 08:27:59 -0500 Subject: [PATCH 1/2] Revert "Revert "Support for non leveldb books was broken"" This reverts commit e5a9f1aa3983c397ff84449b085239bf6bd6c827. Revert this revert because it produces zero byte books when "polyglot make-book ..." is used. --- src/book_make.cpp | 41 +++++++++++------------------------------ 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/src/book_make.cpp b/src/book_make.cpp index 5a55194..228991b 100644 --- a/src/book_make.cpp +++ b/src/book_make.cpp @@ -202,13 +202,7 @@ void book_make(int argc, char * argv[]) { book_sort(); printf("saving entries ...\n"); -// if (Storage == LEVELDB) { -// printf("Saving to leveldb.. \n"); -// book_save(NULL, leveldb_file); -// } -// else { book_save(bin_file, NULL); -// } } @@ -349,32 +343,19 @@ static void book_insert(const char file_name[], const char leveldb_file_name[]) pos = find_entry(board,move); -// if (Storage==POLYGLOT) { -// Book->entry[pos].n++; -// Book->entry[pos].sum += result+1; - Book->entry[pos].game_ids->insert(game_nb); - + if (leveldb_file_name!=NULL) { + Book->entry[pos].game_ids->insert(game_nb); + } + else { + Book->entry[pos].n++; + Book->entry[pos].sum += result+1; + + } + // if (Book->entry[pos].n >= COUNT_MAX) { +// // halve_stats(board->key); // } -// } -// else { -// std::stringstream game_id_stream; -// std::string currentValue; -// leveldb::Status s = db->Get(leveldb::ReadOptions(), uint64_to_string(board->key), ¤tValue); -// if (s.ok()) { -// game_id_stream << currentValue; -// } -// -// game_id_stream << game_nb << ","; -//// for (set::iterator it = Book->entry[pos].game_ids->begin(); it != Book->entry[pos].game_ids->end(); ++it) { -//// game_id_stream << *it << ","; -//// } -//// writeBatch.Put(uint64_to_string(board->key), game_id_stream.str()); -//// db->Put(writeOptions, uint64_to_string(board->key), game_id_stream.str()); -// -// } - move_do(board,move); ply++; @@ -682,7 +663,7 @@ static bool keep_entry(int pos) { entry = &Book->entry[pos]; - // if (entry->n == 0) return false; +// if (entry->n == 0) return false; if (entry->n < MinGame) return false; if (entry->sum == 0) return false; From 336399aadfe44a657d789535709b90e48b1b10bf Mon Sep 17 00:00:00 2001 From: Steven Elliott Date: Thu, 17 Dec 2020 08:32:07 -0500 Subject: [PATCH 2/2] Add .gitignore --- .gitignore | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1129fd3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +# Please keep each section in ASCII (LC_ALL=C sort) order. + +# File patterns to ignore. This applies recursively to all subdirectories. +*.o +.depend + +# Per directory patterns to ignore. These do not apply recursively to +# subdirectories. Each line should begin with "[!]/". Please keep the +# directories in depth first order followed by ASCII (LC_ALL=C sort) order. + +/src/polyglot