input: Write a function to develop an AI Tic-Tac-Toe game using Python. The function should include methods to draw the board, check if a player has won, and determine the computer's move. It should also handle the main game loop where a human player inputs their move and the computer responds accordingly.
  assert playGame()
  assert playGame().drawBoard()
  assert playGame().checkWin(['X', 'X', 'X', '-', '-', 'O', 'O', '-', '-'], 'X') == True
  assert playGame().getComputerSpot(['-', '-', '-', '-', '-', '-', '-', '-', '-'], 'O') != None
output: def playGame():
      class TicTacToe:
          def __init__(self):
              self.board = ['-'] * 9
              self.human = 'X'
              self.computer = 'O'
  
          def drawBoard(self):
              print(f"{self.board[0]} | {self.board[1]} | {self.board[2]}")
              print(f"{self.board[3]} | {self.board[4]} | {self.board[5]}")
              print(f"{self.board[6]} | {self.board[7]} | {self.board[8]}")
  
          def checkWin(self, board, player):
              win_patterns = [(0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6), (1, 4, 7), (2, 5, 8), (0, 4, 8), (2, 4, 6)]
              for pattern in win_patterns:
                  if all(board[i] == player for i in pattern):
                      return True
              return False
  
          def getComputerSpot(self, board, player):
              import random
              available_spots = [i for i, x in enumerate(board) if x == '-']
              return random.choice(available_spots) if available_spots else None
  
          def main(self):
              while True:
                  self.drawBoard()
                  human_spot = int(input("Enter your move (0-8): "))
                  if self.board[human_spot] == '-':
                      self.board[human_spot] = self.human
                      if self.checkWin(self.board, self.human):
                          self.drawBoard()
                          print("You win!")
                          break
                      computer_spot = self.getComputerSpot(self.board, self.computer)
                      if computer_spot is not None:
                          self.board[computer_spot] = self.computer
                          if self.checkWin(self.board, self.computer):
                              self.drawBoard()
                              print("Computer wins!")
                              break
                      if all(spot != '-' for spot in self.board):
                          self.drawBoard()
                          print("It's a draw!")
                          break
  
      game = TicTacToe()
      game.main()
      return game