Remove useTT compile time flag
This commit is contained in:
parent
0b66f67e8c
commit
2fabc785aa
|
@ -73,10 +73,9 @@ proc getEstimatedMoveScore(self: SearchManager, move: Move): Score =
|
|||
nonSideToMove = sideToMove.opposite()
|
||||
if self.previousBestMove != nullMove() and move == self.previousBestMove:
|
||||
return highestEval() + 1
|
||||
when defined(useTT):
|
||||
let query = self.transpositionTable.get(self.board.position.zobristKey)
|
||||
if query.success and query.entry.bestMove != nullMove() and query.entry.bestMove == move:
|
||||
return highestEval() + 1
|
||||
let query = self.transpositionTable.get(self.board.position.zobristKey)
|
||||
if query.success and query.entry.bestMove != nullMove() and query.entry.bestMove == move:
|
||||
return highestEval() + 1
|
||||
if move.isCapture():
|
||||
# Implementation of MVVLVA: Most Valuable Victim Least Valuable Attacker
|
||||
# We prioritize moves that capture the most valuable pieces, and as a
|
||||
|
@ -223,19 +222,18 @@ 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:
|
||||
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
|
||||
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:
|
||||
|
@ -299,9 +297,8 @@ proc search(self: SearchManager, depth, ply: int, alpha, beta: Score): Score {.d
|
|||
if ply == 0:
|
||||
self.bestMoveRoot = move
|
||||
self.bestRootScore = bestScore
|
||||
when defined(useTT):
|
||||
let nodeType = if bestScore >= beta: LowerBound elif bestScore <= alpha: UpperBound else: Exact
|
||||
self.transpositionTable.store(depth.uint8, bestScore, self.board.position.zobristKey, bestMove, nodeType)
|
||||
let nodeType = if bestScore >= beta: LowerBound elif bestScore <= alpha: UpperBound else: Exact
|
||||
self.transpositionTable.store(depth.uint8, bestScore, self.board.position.zobristKey, bestMove, nodeType)
|
||||
|
||||
return bestScore
|
||||
|
||||
|
|
|
@ -353,11 +353,10 @@ proc startUCISession* =
|
|||
of NewGame:
|
||||
session.board = newDefaultChessboard()
|
||||
of Go:
|
||||
when defined(useTT):
|
||||
if session.transpositionTable.isNil() or session.transpositionTable.size() == 0:
|
||||
session.transpositionTable = newTranspositionTable(session.hashTableSize * 1024 * 1024)
|
||||
if session.debug:
|
||||
echo &"info string created {session.hashTableSize} MiB TT"
|
||||
if session.transpositionTable.isNil() or session.transpositionTable.size() == 0:
|
||||
session.transpositionTable = newTranspositionTable(session.hashTableSize * 1024 * 1024)
|
||||
if session.debug:
|
||||
echo &"info string created {session.hashTableSize} MiB TT"
|
||||
session.searchThread = new Thread[tuple[session: UCISession, command: UCICommand]]
|
||||
createThread(session.searchThread[], bestMove, (session, cmd))
|
||||
if session.debug:
|
||||
|
|
Loading…
Reference in New Issue