code: def eval_tic_tac_toe(
      value_weight, num_epoch_rounds=1, games=10**4, rollouts=10**5
  ):
      """
      Returns the average reward over 1k games after 100k rollouts
      :param value_weight:
      :return:
      """
      env = deepchem.rl.envs.tictactoe.TicTacToeEnvironment()
      policy = TicTacToePolicy()
      model_dir = "/tmp/tictactoe"
      try:
          shutil.rmtree(model_dir)
      except:
          pass
  
      avg_rewards = []
      for j in range(num_epoch_rounds):
          a3c = dc.rl.A3C(
              env,
              policy,
              entropy_weight=0.01,
              value_weight=value_weight,
              model_dir=model_dir,
              optimizer=Adam(learning_rate=0.001),
          )
          try:
              a3c.restore()
          except:
              print("unable to restore")
              pass
          a3c.fit(rollouts)
          rewards = []
          for i in range(games):
              env.reset()
              reward = -float("inf")
              while not env._terminated:
                  action = a3c.select_action(env._state)
                  reward = env.step(action)
              rewards.append(reward)
          avg_rewards.append({(j + 1) * rollouts: np.mean(rewards)})
      return avg_rewards
  
file_path: deepchem/contrib/rl/tictactoe.py
imports: import copy
  import random
  import shutil
  import numpy
  import tensorflow
  import deepchem
  import deepchem.rl.envs.tictactoe
  from deepchem.models.tensorgraph.layers import Flatten, Dense, SoftMax, BatchNorm, Squeeze
  from deepchem.models.optimizers import Adam
label_desc: Use image node_id 1 for calling a global function with example usage: eval_tic_tac_toe(value_weight, num_epoch_rounds, games, rollouts) and returns: avg_rewards