input: Write a python function to find the best move for player 1 in a Tic-Tac-Toe game using a heuristic and the minimax algorithm.
  assert tic_tac_toe_heuristic([0, 0, 0, 0, 0, 0, 0, 0, 0]) in range(9)
  assert tic_tac_toe_heuristic([1, 2, 0, 1, 2, 0, 1, 0, 0]) == 7
  assert tic_tac_toe_heuristic([1, 1, 0, 2, 2, 0, 0, 0, 0]) == 2
output: def tic_tac_toe_heuristic(board):
      def is_winner(board, player):
          win_states = [
              [board[0], board[1], board[2]],
              [board[3], board[4], board[5]],
              [board[6], board[7], board[8]],
              [board[0], board[3], board[6]],
              [board[1], board[4], board[7]],
              [board[2], board[5], board[8]],
              [board[0], board[4], board[8]],
              [board[2], board[4], board[6]]
          ]
          return [player, player, player] in win_states
  
      def minimax(board, depth, is_maximizing):
          if is_winner(board, 1):
              return 10 - depth
          if is_winner(board, 2):
              return depth - 10
          if 0 not in board:
              return 0
          
          if is_maximizing:
              best_score = float('-inf')
              for i in range(9):
                  if board[i] == 0:
                      board[i] = 1
                      score = minimax(board, depth + 1, False)
                      board[i] = 0
                      best_score = max(best_score, score)
              return best_score
          else:
              best_score = float('inf')
              for i in range(9):
                  if board[i] == 0:
                      board[i] = 2
                      score = minimax(board, depth + 1, True)
                      board[i] = 0
                      best_score = min(best_score, score)
              return best_score
  
      best_move = -1
      best_score = float('-inf')
      for i in range(9):
          if board[i] == 0:
              board[i] = 1
              score = minimax(board, 0, False)
              board[i] = 0
              if score > best_score:
                  best_score = score
                  best_move = i
      return best_move