From: Gian-Carlo Pascutto Date: Tue, 17 Jul 2018 21:13:12 +0000 (+0200) Subject: Allow Position::init() to be called multiple times. X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=e0f317afaad77bdc265a586f06a30066b5129e4f Allow Position::init() to be called multiple times. For the rationale to allow this, see commit a66c73deef420104e74b6645ee60e20b37fd8549 This was broken when cuckoo hashing was added, and subtly broke (for example) lichess' Android application, thus illustrating the original judgement was sound. No functional change. --- diff --git a/src/position.cpp b/src/position.cpp index 29a2b314..84c7ae8f 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -168,6 +168,8 @@ void Position::init() { Zobrist::noPawns = rng.rand(); // Prepare the cuckoo tables + std::memset(cuckoo, 0, sizeof(cuckoo)); + std::memset(cuckooMove, 0, sizeof(cuckooMove)); int count = 0; for (Piece pc : Pieces) for (Square s1 = SQ_A1; s1 <= SQ_H8; ++s1)