input: Write a function to implement a reinforcement learning environment for playing tic-tac-toe in Python. The function should initialize the game state, switch players, check for a winner, and provide rewards based on game outcomes. The function should return the game state, reward, whether the game is done, and any additional information after each move.
  assert TicTacToeEnv().reset() == [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']
  assert TicTacToeEnv().step(0) == (['X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], 0, False, None)
  assert TicTacToeEnv().step(4) == (['X', ' ', ' ', ' ', 'O', ' ', ' ', ' ', ' '], 0, False, None)
  assert TicTacToeEnv().step(1) == (['X', 'X', ' ', ' ', 'O', ' ', ' ', ' ', ' '], 0, False, None)
  assert TicTacToeEnv().step(7) == (['X', 'X', ' ', ' ', 'O', ' ', ' ', 'O', ' '], 0, False, None)
output: def reset():
      return [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']
  
  def step(action):
      state = reset()
      player = 'X'
      for i in range(9):
          if state[i] == ' ':
              state[i] = player
              if player == 'X':
                  player = 'O'
              else:
                  player = 'X'
          if i == action:
              break
      reward = 0
      done = False
      info = None
      return state, reward, done, info