Remove buggy ponder move tracking as it is already handled by the UCI spec

This commit is contained in:
Mattia Giambirtone 2024-05-12 23:18:53 +02:00
parent 133cde53b2
commit 2c840f2f3c
Signed by: nocturn9x
GPG Key ID: 37B83AB6C3BE6514
2 changed files with 4 additions and 16 deletions

View File

@ -16,7 +16,6 @@ requires "nim >= 2.0.4"
requires "jsony >= 1.1.5" requires "jsony >= 1.1.5"
requires "nint128 >= 0.3.3" requires "nint128 >= 0.3.3"
requires "nimpy >= 0.2.0" requires "nimpy >= 0.2.0"
requires "scinim >= 0.2.5"
task test, "Runs the test suite": task test, "Runs the test suite":

View File

@ -46,7 +46,6 @@ type
historyTable: ptr HistoryTable historyTable: ptr HistoryTable
# Storage for our killer move heuristic # Storage for our killer move heuristic
killerMoves: ptr KillersTable killerMoves: ptr KillersTable
ponderMove: ptr Move
UCICommandType = enum UCICommandType = enum
## A UCI command type enumeration ## A UCI command type enumeration
@ -337,12 +336,10 @@ proc bestMove(args: tuple[session: UCISession, command: UCICommand]) {.thread.}
elif timeRemaining == 0: elif timeRemaining == 0:
timeRemaining = int32.high() timeRemaining = int32.high()
var line = searcher.findBestLine(timeRemaining, increment, command.depth, command.nodes, command.searchmoves, timePerMove, command.ponder) var line = searcher.findBestLine(timeRemaining, increment, command.depth, command.nodes, command.searchmoves, timePerMove, command.ponder)
if session.ponderMove[] == nullMove(): if line.len() == 1:
if line.len() == 1: echo &"bestmove {line[0].toAlgebraic()}"
echo &"bestmove {line[0].toAlgebraic()}" else:
else: echo &"bestmove {line[0].toAlgebraic()} ponder {line[1].toAlgebraic()}"
session.ponderMove[] = line[1]
echo &"bestmove {line[0].toAlgebraic()} ponder {line[1].toAlgebraic()}"
proc startUCISession* = proc startUCISession* =
@ -363,8 +360,6 @@ proc startUCISession* =
session.transpositionTable[] = newTranspositionTable(session.hashTableSize * 1024 * 1024) session.transpositionTable[] = newTranspositionTable(session.hashTableSize * 1024 * 1024)
session.historyTable = cast[ptr HistoryTable](alloc0(sizeof(HistoryTable))) session.historyTable = cast[ptr HistoryTable](alloc0(sizeof(HistoryTable)))
session.killerMoves = cast[ptr KillersTable](alloc0(sizeof(KillersTable))) session.killerMoves = cast[ptr KillersTable](alloc0(sizeof(KillersTable)))
session.ponderMove = cast[ptr Move](alloc(sizeof(Move)))
session.ponderMove[] = nullMove()
# (Re-)Initialize history table # (Re-)Initialize history table
for color in PieceColor.White..PieceColor.Black: for color in PieceColor.White..PieceColor.Black:
for i in Square(0)..Square(63): for i in Square(0)..Square(63):
@ -428,11 +423,6 @@ proc startUCISession* =
echo "info string ponder move has been hit" echo "info string ponder move has been hit"
if not session.searchFlag[].load(): if not session.searchFlag[].load():
continue continue
var b = newChessboardFromFEN(session.position.toFEN())
b.makeMove(session.ponderMove[])
session.position = b.position
session.ponderMove[] = nullMove()
session.stopFlag[].store(true)
joinThread(searchThread) joinThread(searchThread)
if session.debug: if session.debug:
echo "info string ponder search stopped" echo "info string ponder search stopped"
@ -440,7 +430,6 @@ proc startUCISession* =
if session.debug: if session.debug:
echo "info string search started" echo "info string search started"
of Go: of Go:
session.ponderMove[] = nullMove()
when not defined(historyPenalty): when not defined(historyPenalty):
# Scale our history coefficients # Scale our history coefficients
for color in PieceColor.White..PieceColor.Black: for color in PieceColor.White..PieceColor.Black: