Hopefully fix crashing issues

This commit is contained in:
Mattia Giambirtone 2024-05-02 00:24:57 +02:00
parent fe7e64e9c3
commit fe453aa3fd
2 changed files with 6 additions and 2 deletions

View File

@ -65,6 +65,9 @@ type
mailbox*: array[Square(0)..Square(63), Piece] mailbox*: array[Square(0)..Square(63), Piece]
proc toFEN*(self: Position): string
func inCheck*(self: Position): bool {.inline.} = func inCheck*(self: Position): bool {.inline.} =
## Returns if the current side to move is in check ## Returns if the current side to move is in check
return self.checkers != 0 return self.checkers != 0

View File

@ -357,8 +357,9 @@ proc startUCISession* =
of NewGame: of NewGame:
session.board = newDefaultChessboard() session.board = newDefaultChessboard()
of Go: of Go:
var thread: Thread[tuple[session: UCISession, command: UCICommand]] var thread = new Thread[tuple[session: UCISession, command: UCICommand]]
createThread(thread, bestMove, (session, cmd)) createThread(thread[], bestMove, (session, cmd))
GcRef(thread)
of Stop: of Stop:
session.currentSearch.load().stop() session.currentSearch.load().stop()
of SetOption: of SetOption: