Professional Documents
Culture Documents
Evaluate Tic Tac Toe
Evaluate Tic Tac Toe
# Check if the current game state results in a win for the player.
if is_winner(node, 'X'):
return 10 # Player X wins
elif is_winner(node, 'O'):
return -10 # Player O wins
elif is_board_full(node):
return 0 # It's a draw
else:
return 0 # No winner yet; return a neutral value