input: Write a function to implement a simple AI Tic-Tac-Toe game in Python. The function should initialize and manage the game board, check for a win condition, and handle player and computer moves. Return True if the game is won by any player, and False if the game ends in a draw or is still ongoing. The function should also print the game board after each move.
  assert playGame() == True
  assert playGame() == False
output: def playGame():
      board = [[' ' for _ in range(3)] for _ in range(3)]
      def print_board():
          for row in board:
              print('|'.join(row))
              print('-' * 5)
      def check_win():
          for row in board:
              if row[0] == row[1] == row[2] != ' ':
                  return True
          for col in range(3):
              if board[0][col] == board[1][col] == board[2][col] != ' ':
                  return True
          if board[0][0] == board[1][1] == board[2][2] != ' ':
              return True
          if board[0][2] == board[1][1] == board[2][0] != ' ':
              return True
          return False
      def is_full():
          return all(cell != ' ' for row in board for cell in row)
      def player_move():
          while True:
              try:
                  row, col = map(int, input("Enter row and column (0-2): ").split())
                  if board[row][col] == ' ':
                      board[row][col] = 'X'
                      break
                  else:
                      print("Cell already taken, try again.")
              except (ValueError, IndexError):
                  print("Invalid input, try again.")
      def computer_move():
          import random
          while True:
              row, col = random.randint(0, 2), random.randint(0, 2)
              if board[row][col] == ' ':
                  board[row][col] = 'O'
                  break
      while True:
          player_move()
          print_board()
          if check_win():
              return True
          if is_full():
              return False
          computer_move()
          print_board()
          if check_win():
              return True
          if is_full():
              return False