docstr: This function executes one episode of self-play, starting with player 1.
  As the game goes on, each turn is added as a training example to
  trainExamples. The game is played till the game ends. After the game
  ends, the outcome of the game is used to assign values to each example
  in trainExamples.
  
  It uses a temp=1 if episodeStep < tempThresholdStep, and thereafter
  uses temp=0.
  
  Returns:
      trainExamples: a list of examples of the form (canonicalBoard, currPlayer, pi,v)
                     pi is the MCTS informed policy vector, v is +1 if
                     the player eventually won the game, else -1.
docstr_tok: ["This","function","executes","one","episode","of","self-play",",","starting","with","player","1",".","As","the","game","goes","on",",","each","turn","is","added","as","a","training","example","to","trainExamples",".","The","game","is","played","till","the","game","ends",".","After","the","game","ends",",","the","outcome","of","the","game","is","used","to","assign","values","to","each","example","in","trainExamples",".","It","uses","a","temp=1","if","episodeStep","<","tempThresholdStep",",","and","thereafter","uses","temp=0",".","Returns",":","trainExamples",":","a","list","of","examples","of","the","form","(","canonicalBoard",",","currPlayer",",","pi",",","v",")","pi","is","the","MCTS","informed","policy","vector",",","v","is","+1","if","the","player","eventually","won","the","game",",","else","-1","."]
code: def _executeEpisode(self):
      """
  
      This function executes one episode of self-play, starting with player 1.
      As the game goes on, each turn is added as a training example to
      trainExamples. The game is played till the game ends. After the game
      ends, the outcome of the game is used to assign values to each example
      in trainExamples.
  
      It uses a temp=1 if episodeStep < tempThresholdStep, and thereafter
      uses temp=0.
  
      Returns:
          trainExamples: a list of examples of the form (canonicalBoard, currPlayer, pi,v)
                         pi is the MCTS informed policy vector, v is +1 if
                         the player eventually won the game, else -1.
      """
      trainExamples = []
      board = self.game.getInitBoard()
      self.curPlayer = 1
      episodeStep = 0
  
      while True:
          episodeStep += 1
          canonicalBoard = self.game.getCanonicalForm(
              board, self.curPlayer
          )
          temp = int(episodeStep < self.args.tempThresholdStep)
  
          pi = self.current_mcts.getActionProb(
              canonicalBoard, temp=temp
          )
          sym = self.game.getSymmetries(canonicalBoard, pi)
          for b, p in sym:  # board, pi
              trainExamples.append([b, self.curPlayer, p, None])
  
          action = np.random.choice(len(pi), p=pi)
          board, self.curPlayer = self.game.getNextState(
              board, self.curPlayer, action
          )
  
          r = self.game.getGameEnded(board, self.curPlayer)
  
          if r != 0:
              return [
                  (x[0], x[2], r * ((-1) ** (x[1] != self.curPlayer)))
                  for x in trainExamples
              ]
  
file_path: PARL/benchmark/torch/AlphaZero/actor.py
imports: import numpy
  import parl
  import os
  from alphazero_agent import create_agent
  from MCTS import MCTS
  from Arena import Arena
  from utils import win_loss_draw
label_desc: Use image node_id 5 for calling the Actor obj's underlying member method code with example usage: obj._executeEpisode() and returns: unknown