X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fbook.cpp;h=2aca81cfd0b81971c2c7086de1f331e983464842;hp=a34d17b74ca7dc13c46c4ab0535b9d0d639356c3;hb=8fb16df70e032c782b6bf81b211e8dab1724a7dc;hpb=f5e28ef5127ff29310f9c2e8e321eb24214f2439 diff --git a/src/book.cpp b/src/book.cpp index a34d17b7..2aca81cf 100644 --- a/src/book.cpp +++ b/src/book.cpp @@ -346,7 +346,7 @@ namespace { Book::Book() { for (int i = abs(get_system_time() % 10000); i > 0; i--) - RKiss.rand32(); + RKiss.rand(); } @@ -412,7 +412,7 @@ Move Book::get_move(const Position& pos, bool findBestMove) { BookEntry entry; int bookMove = MOVE_NONE; - int scoresSum = 0, bestScore = 0; + unsigned scoresSum = 0, bestScore = 0; uint64_t key = book_key(pos); // Choose a book move among the possible moves for the given position @@ -422,9 +422,7 @@ Move Book::get_move(const Position& pos, bool findBestMove) { if (entry.key != key) break; - int score = entry.count; - - assert(score > 0); + unsigned score = entry.count; // If findBestMove is true choose highest rated book move if (findBestMove) @@ -441,7 +439,7 @@ Move Book::get_move(const Position& pos, bool findBestMove) { // high score it has more probability to be choosen then a one with // lower score. Note that first entry is always chosen. scoresSum += score; - if (int(RKiss.rand32() % scoresSum) < score) + if (RKiss.rand() % scoresSum < score) bookMove = entry.move; } if (!bookMove)