From d4dfa6b325d5d78f61e3ccf695aae9030d814159 Mon Sep 17 00:00:00 2001 From: nocturn9x Date: Tue, 14 May 2024 17:03:28 +0200 Subject: [PATCH] Fix clear() proc for transposition table --- Chess/nimfish/nimfishpkg/transpositions.nim | 3 ++- Chess/nimfish/nimfishpkg/uci.nim | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Chess/nimfish/nimfishpkg/transpositions.nim b/Chess/nimfish/nimfishpkg/transpositions.nim index eee278c..7707e81 100644 --- a/Chess/nimfish/nimfishpkg/transpositions.nim +++ b/Chess/nimfish/nimfishpkg/transpositions.nim @@ -85,7 +85,8 @@ func clear*(self: var TTable) {.inline.} = ## Clears the transposition table ## without releasing the memory ## associated with it - self.data.setLen(0) + for i in 0..self.data.high(): + self.data[i] = TTEntry() func resize*(self: var TTable, newSize: uint64) = diff --git a/Chess/nimfish/nimfishpkg/uci.nim b/Chess/nimfish/nimfishpkg/uci.nim index bb3dd5b..c05db20 100644 --- a/Chess/nimfish/nimfishpkg/uci.nim +++ b/Chess/nimfish/nimfishpkg/uci.nim @@ -466,6 +466,8 @@ proc startUCISession* = if session.debug: echo &"info string set TT hash table size to {session.hashTableSize} MiB" of "TTClear": + if session.debug: + echo "info string clearing TT" transpositionTable[].clear() of "Threads": let numWorkers = cmd.value.parseInt()