Uncomment tt cutoff code

This commit is contained in:
Mattia Giambirtone 2024-05-02 15:41:30 +02:00
parent a3c8eb7a35
commit 1e06a5caef
1 changed files with 13 additions and 14 deletions

View File

@ -52,7 +52,6 @@ proc newSearchManager*(board: Chessboard, transpositions: TTable): SearchManager
result.transpositionTable = transpositions
proc isSearching*(self: SearchManager): bool =
## Returns whether a search for the best
## move is in progress
@ -222,19 +221,19 @@ proc search(self: SearchManager, depth, ply: int, alpha, beta: Score): Score {.d
# one because then we wouldn't have a move to return.
# In practice this should not be a problem
return
# when defined(useTT):
# if ply > 0:
# let query = self.transpositionTable.get(self.board.position.zobristKey, depth.uint8)
# if query.success:
# case query.entry.flag:
# of Exact:
# return query.entry.score
# of LowerBound:
# if query.entry.score >= beta:
# return query.entry.score
# of UpperBound:
# if query.entry.score <= alpha:
# return query.entry.score
when defined(useTT):
if ply > 0:
let query = self.transpositionTable.get(self.board.position.zobristKey, depth.uint8)
if query.success:
case query.entry.flag:
of Exact:
return query.entry.score
of LowerBound:
if query.entry.score >= beta:
return query.entry.score
of UpperBound:
if query.entry.score <= alpha:
return query.entry.score
if self.board.drawnByRepetition():
return Score(0)
if depth == 0: