A terminal position is a game state where play ends in a win or a draw. In minimax, it is a base case: the outcome receives a score that returns through the recursive search. section 8.4
var isDraw: Bool {
return !isWin && legalMoves.count == 0
}
}
A tic-tac-toe position is a draw when it is not a win and has no legal moves. section 8.4
The example assigns 1 to a win for the player being evaluated, -1 to a loss, and 0 to a draw. For games with search too deep to reach an actual terminal position, minimax can stop at a chosen depth and use a heuristic evaluation instead. section 8.4

