Hopefully fix crashing issues

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

View File

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

View File

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