code: def test_keep_playing(self):
      ttt = ttt_env.TicTacToeEnv(strict=False)
      done = False
      while not done:
          # sample an action from the action space.
          action = ttt.action_space.sample()
          # play it -- could be a no-op since we don't see if positions are empty.
          unused_observation, reward, done, unused_info = ttt.step(
              action
          )
  
      # done is True, so either:
      # we won
      # env won or
      # no space left
  
      we_won = reward == 1
      env_won = reward == -1
      space = bool(ttt_env.get_open_spaces(ttt.board_state))
      self.assertTrue(we_won or env_won or not space)
  
file_path: tensor2tensor/tensor2tensor/envs/tic_tac_toe_env_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from tensor2tensor.envs import tic_tac_toe_env
  import tensorflow.compat.v1
label_desc: Use image node_id 3 for calling the TicTacToeEnvTest obj's underlying member method code with example usage: obj.test_keep_playing() without return types