class_docstr: Simple TicTacToe Env, starts the game randomly half of the time.
code: def step(self, action):
      # Are we already done?
      if self.strict:
          assert not self.done
  
      # Action has to belong to the action state.
      assert self.action_space.contains(action)
  
      # Is it a legitimate move, i.e. is that position open to play?
      is_legit_move = action in get_open_spaces(self.board_state)
  
      # Shouldn"t be an illegal action -- is a noop if not strict.
      if self.strict:
          assert is_legit_move
  
      # If strict mode is off, then let this be a noop and env not play either.
      if not is_legit_move:
          return self.board_state, 0, False, {}
  
      # This is a legit move, perform the action and check if done, etc etc.
      i, j = decode_pos(action)
      self.board_state[i, j] = 1
      reward, done = get_reward_and_done(self.board_state)
  
      if done:
          self.done = True
          return self.board_state, reward, True, {}
  
      # If not done already, play our move.
      self.play_random_move()
      reward, done = get_reward_and_done(self.board_state)
      self.done = done
      return self.board_state, reward, self.done, {}
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import gym
  from gym import spaces
  from gym.utils import seeding
  import numpy
  from tensor2tensor.data_generators import problem
  from tensor2tensor.layers import modalities
  from tensor2tensor.rl import gym_utils
label_desc: Use image node_id 6 for calling the TicTacToeEnv obj's underlying member method code with example usage: obj.step(action) and returns: self,  reward,  self,  dict, self,  int,  False,  dict, self,  reward,  True,  dict